Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Administration / WebAdminConfigurationHelper.cs / 1 / WebAdminConfigurationHelper.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /************************************************************************************************************/ namespace System.Web.Administration { using System; using System.Collections.Specialized; using System.Configuration; using System.Configuration.Provider; using System.Reflection; using System.Web; using System.Web.Hosting; using System.Web.Management; using System.Web.Security; using System.Web.Util; using System.Web.UI; using System.Security.Permissions; [Serializable] internal sealed class WebAdminConfigurationHelper : MarshalByRefObject, IRegisteredObject { public WebAdminConfigurationHelper() { HostingEnvironment.RegisterObject(this); } public override Object InitializeLifetimeService() { return null; // never expire lease } public VirtualDirectory GetVirtualDirectory(string path) { if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } return HostingEnvironment.VirtualPathProvider.GetDirectory(path); } public object CallMembershipProviderMethod (string methodName, object[] parameters, Type[] paramTypes) { Type tempType = typeof(HttpContext).Assembly.GetType("System.Web.Security.Membership"); object returnObject = null; BindingFlags allBindingFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = null; if (paramTypes != null) { method = tempType.GetMethod(methodName, allBindingFlags, null, paramTypes, null); } else { method = tempType.GetMethod(methodName, allBindingFlags); } if (method != null) { if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } returnObject = method.Invoke(null, parameters); } object[] newValues = new object[parameters.Length + 1]; newValues[0] = returnObject; int j = 1; for (int i = 0; i < (parameters.Length); i++) { newValues[j++] = parameters[i]; } returnObject = (object) newValues; return returnObject; } public object GetMembershipProviderProperty(string propertyName) { Type tempType = typeof(HttpContext).Assembly.GetType("System.Web.Security.Membership"); object returnObject = null; BindingFlags allBindingFlags = BindingFlags.GetProperty | BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } returnObject = tempType.InvokeMember(propertyName, allBindingFlags, null, null, null, System.Globalization.CultureInfo.InvariantCulture); return returnObject; } public object CallRoleProviderMethod (string methodName, object[] parameters, Type[] paramTypes) { Type tempType = typeof(HttpContext).Assembly.GetType("System.Web.Security.Roles"); object returnObject = null; BindingFlags allBindingFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = null; if (paramTypes != null) { method = tempType.GetMethod(methodName, allBindingFlags, null, paramTypes, null); } else { method = tempType.GetMethod(methodName, allBindingFlags); } if (method != null) { if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } returnObject = method.Invoke(null, parameters); } object[] newValues = new object[parameters.Length + 1]; newValues[0] = returnObject; int j = 1; for (int i = 0; i < (parameters.Length); i++) { newValues[j++] = parameters[i]; } returnObject = (object) newValues; return returnObject; } void IRegisteredObject.Stop(bool immediate) { HostingEnvironment.UnregisterObject(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /************************************************************************************************************/ namespace System.Web.Administration { using System; using System.Collections.Specialized; using System.Configuration; using System.Configuration.Provider; using System.Reflection; using System.Web; using System.Web.Hosting; using System.Web.Management; using System.Web.Security; using System.Web.Util; using System.Web.UI; using System.Security.Permissions; [Serializable] internal sealed class WebAdminConfigurationHelper : MarshalByRefObject, IRegisteredObject { public WebAdminConfigurationHelper() { HostingEnvironment.RegisterObject(this); } public override Object InitializeLifetimeService() { return null; // never expire lease } public VirtualDirectory GetVirtualDirectory(string path) { if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } return HostingEnvironment.VirtualPathProvider.GetDirectory(path); } public object CallMembershipProviderMethod (string methodName, object[] parameters, Type[] paramTypes) { Type tempType = typeof(HttpContext).Assembly.GetType("System.Web.Security.Membership"); object returnObject = null; BindingFlags allBindingFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = null; if (paramTypes != null) { method = tempType.GetMethod(methodName, allBindingFlags, null, paramTypes, null); } else { method = tempType.GetMethod(methodName, allBindingFlags); } if (method != null) { if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } returnObject = method.Invoke(null, parameters); } object[] newValues = new object[parameters.Length + 1]; newValues[0] = returnObject; int j = 1; for (int i = 0; i < (parameters.Length); i++) { newValues[j++] = parameters[i]; } returnObject = (object) newValues; return returnObject; } public object GetMembershipProviderProperty(string propertyName) { Type tempType = typeof(HttpContext).Assembly.GetType("System.Web.Security.Membership"); object returnObject = null; BindingFlags allBindingFlags = BindingFlags.GetProperty | BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } returnObject = tempType.InvokeMember(propertyName, allBindingFlags, null, null, null, System.Globalization.CultureInfo.InvariantCulture); return returnObject; } public object CallRoleProviderMethod (string methodName, object[] parameters, Type[] paramTypes) { Type tempType = typeof(HttpContext).Assembly.GetType("System.Web.Security.Roles"); object returnObject = null; BindingFlags allBindingFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = null; if (paramTypes != null) { method = tempType.GetMethod(methodName, allBindingFlags, null, paramTypes, null); } else { method = tempType.GetMethod(methodName, allBindingFlags); } if (method != null) { if (HttpRuntime.NamedPermissionSet != null) { HttpRuntime.NamedPermissionSet.PermitOnly(); } returnObject = method.Invoke(null, parameters); } object[] newValues = new object[parameters.Length + 1]; newValues[0] = returnObject; int j = 1; for (int i = 0; i < (parameters.Length); i++) { newValues[j++] = parameters[i]; } returnObject = (object) newValues; return returnObject; } void IRegisteredObject.Stop(bool immediate) { HostingEnvironment.UnregisterObject(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ParagraphResult.cs
- TextSimpleMarkerProperties.cs
- HitTestParameters3D.cs
- AssemblyEvidenceFactory.cs
- UnsafeNativeMethods.cs
- ObjectListFieldsPage.cs
- RenderCapability.cs
- DiscoveryServerProtocol.cs
- SelectedDatesCollection.cs
- UriSection.cs
- PriorityItem.cs
- SQLSingle.cs
- OleDbSchemaGuid.cs
- ObjectQuery_EntitySqlExtensions.cs
- XMLDiffLoader.cs
- VersionPair.cs
- XmlDictionaryString.cs
- TypeConverter.cs
- WebAdminConfigurationHelper.cs
- WindowsToolbar.cs
- RectAnimation.cs
- ChangeTracker.cs
- Atom10FormatterFactory.cs
- BrowserCapabilitiesCompiler.cs
- ImageFormatConverter.cs
- StateManagedCollection.cs
- IndexedString.cs
- EmbeddedObject.cs
- CriticalFinalizerObject.cs
- Stream.cs
- ObjectDataSourceView.cs
- Win32NamedPipes.cs
- Transform3DGroup.cs
- IsolatedStorageFilePermission.cs
- CodeExpressionCollection.cs
- MenuItemStyle.cs
- VariantWrapper.cs
- TrackingConditionCollection.cs
- Visual3D.cs
- DocumentAutomationPeer.cs
- AttachedPropertyBrowsableAttribute.cs
- WSTransactionSection.cs
- StateMachineWorkflow.cs
- RecognizedWordUnit.cs
- ScalarConstant.cs
- HMACRIPEMD160.cs
- XmlCharCheckingWriter.cs
- PathParser.cs
- BrowsableAttribute.cs
- ExpressionPrefixAttribute.cs
- ValueUnavailableException.cs
- Models.cs
- SynchronizedDispatch.cs
- Storyboard.cs
- ContentPathSegment.cs
- CoTaskMemUnicodeSafeHandle.cs
- BindableAttribute.cs
- SignatureDescription.cs
- FilteredDataSetHelper.cs
- CodeGenerator.cs
- DrawingContextDrawingContextWalker.cs
- RequestQueue.cs
- PathFigure.cs
- ScriptingWebServicesSectionGroup.cs
- EventLogLink.cs
- TypeNameConverter.cs
- Timeline.cs
- CodeParameterDeclarationExpressionCollection.cs
- ObjectListTitleAttribute.cs
- SslStream.cs
- PrimitiveList.cs
- XPathItem.cs
- Utility.cs
- TimeSpan.cs
- PropertyPathConverter.cs
- Substitution.cs
- IdnMapping.cs
- AnimationTimeline.cs
- ComplexTypeEmitter.cs
- ToolStripArrowRenderEventArgs.cs
- TypeResolver.cs
- BitmapSizeOptions.cs
- BaseCollection.cs
- DateTimeOffsetStorage.cs
- CustomAttributeBuilder.cs
- NamedPipeConnectionPool.cs
- SrgsElementFactoryCompiler.cs
- TrackingMemoryStreamFactory.cs
- TheQuery.cs
- DataControlExtensions.cs
- ChtmlTextWriter.cs
- GridViewSortEventArgs.cs
- XXXOnTypeBuilderInstantiation.cs
- NumberAction.cs
- EntityDataSourceContextCreatedEventArgs.cs
- SiteMapProvider.cs
- TableLayout.cs
- NotImplementedException.cs
- LocatorPartList.cs
- LinearKeyFrames.cs