Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / Administration / WebAdminConfigurationHelper.cs / 5 / 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
- ArraySegment.cs
- ConfigurationPermission.cs
- ObjectListDesigner.cs
- AttachedAnnotationChangedEventArgs.cs
- Lease.cs
- ContentFileHelper.cs
- BaseCodePageEncoding.cs
- ColumnResizeAdorner.cs
- CheckBox.cs
- PointLight.cs
- QilIterator.cs
- TreeChangeInfo.cs
- NamespaceMapping.cs
- ZoomPercentageConverter.cs
- ScriptManager.cs
- CommonProperties.cs
- ObjectKeyFrameCollection.cs
- HwndHostAutomationPeer.cs
- WmlMobileTextWriter.cs
- ParseNumbers.cs
- DeferredElementTreeState.cs
- OutputScopeManager.cs
- StylusPointProperty.cs
- StorageBasedPackageProperties.cs
- ActiveXSite.cs
- SqlParameterizer.cs
- SchemaImporterExtensionElement.cs
- LabelInfo.cs
- EntityTemplateFactory.cs
- DesignerTransactionCloseEvent.cs
- NeutralResourcesLanguageAttribute.cs
- WindowsButton.cs
- JournalEntryListConverter.cs
- AllMembershipCondition.cs
- AssemblyBuilderData.cs
- EntityDataSourceStatementEditorForm.cs
- XNodeNavigator.cs
- DecoderBestFitFallback.cs
- DefaultEvaluationContext.cs
- PreviewPrintController.cs
- PermissionSetTriple.cs
- UnmanagedMarshal.cs
- Menu.cs
- DbDataRecord.cs
- TargetPerspective.cs
- TrackingRecord.cs
- EntityDataSourceQueryBuilder.cs
- Bidi.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- SiteMapNodeItemEventArgs.cs
- StyleModeStack.cs
- IOThreadTimer.cs
- CachedBitmap.cs
- OutKeywords.cs
- HttpRawResponse.cs
- CodeCommentStatementCollection.cs
- SoapIncludeAttribute.cs
- WindowsFont.cs
- FixedSOMTable.cs
- ClientScriptManager.cs
- NetworkInformationException.cs
- RegexCompilationInfo.cs
- CodeDomDecompiler.cs
- EdmItemCollection.cs
- SHA1Managed.cs
- StylusPointCollection.cs
- SpeakProgressEventArgs.cs
- TemplateColumn.cs
- StackSpiller.Bindings.cs
- EpmSyndicationContentSerializer.cs
- TraceHelpers.cs
- TextServicesContext.cs
- ElementsClipboardData.cs
- OdbcError.cs
- OdbcCommand.cs
- SlotInfo.cs
- TrackBar.cs
- AtomServiceDocumentSerializer.cs
- AtomServiceDocumentSerializer.cs
- CreateUserErrorEventArgs.cs
- SyndicationContent.cs
- ConfigurationLockCollection.cs
- XmlSortKey.cs
- XmlCollation.cs
- CompensationParticipant.cs
- SslStreamSecurityElement.cs
- SuppressIldasmAttribute.cs
- XPathExpr.cs
- IpcClientChannel.cs
- DataTableReader.cs
- FragmentNavigationEventArgs.cs
- AssertFilter.cs
- TransportConfigurationTypeElementCollection.cs
- Application.cs
- DataStorage.cs
- CallSiteBinder.cs
- SplashScreenNativeMethods.cs
- ReadOnlyAttribute.cs
- ThreadNeutralSemaphore.cs
- HttpContextServiceHost.cs