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
- WebAdminConfigurationHelper.cs
- ThreadAbortException.cs
- ToolboxItem.cs
- ShapeTypeface.cs
- BufferedGraphicsContext.cs
- SettingsBase.cs
- ComponentRenameEvent.cs
- XXXInfos.cs
- SponsorHelper.cs
- SecurityUtils.cs
- StateDesignerConnector.cs
- StringUtil.cs
- TimeIntervalCollection.cs
- CapabilitiesPattern.cs
- Root.cs
- MouseEvent.cs
- UpdatableWrapper.cs
- FontNamesConverter.cs
- HostingEnvironmentSection.cs
- EntryWrittenEventArgs.cs
- HostedNamedPipeTransportManager.cs
- ParseHttpDate.cs
- CatalogPartCollection.cs
- XsltQilFactory.cs
- MexHttpBindingCollectionElement.cs
- Comparer.cs
- CheckableControlBaseAdapter.cs
- WebPartConnectionsConnectVerb.cs
- WebPartMinimizeVerb.cs
- TimeSpanValidator.cs
- DataTableClearEvent.cs
- ActiveXSite.cs
- Vector3DValueSerializer.cs
- ellipse.cs
- ReturnValue.cs
- Expander.cs
- NavigationPropertyEmitter.cs
- LineGeometry.cs
- XsdBuilder.cs
- BindingExpressionBase.cs
- InheritanceContextChangedEventManager.cs
- ComPlusServiceLoader.cs
- AddInEnvironment.cs
- RotateTransform.cs
- ImageBrush.cs
- CompositeFontFamily.cs
- HttpPostedFile.cs
- WindowPattern.cs
- MulticastOption.cs
- basenumberconverter.cs
- SoundPlayerAction.cs
- AssemblyName.cs
- DynamicMetaObject.cs
- IPAddress.cs
- WebBaseEventKeyComparer.cs
- WebPartAddingEventArgs.cs
- ParenthesizePropertyNameAttribute.cs
- WorkflowInspectionServices.cs
- EntityContainer.cs
- Pair.cs
- DirectionalLight.cs
- IgnoreDeviceFilterElementCollection.cs
- Soap.cs
- TableFieldsEditor.cs
- CredentialSelector.cs
- XmlSchemaRedefine.cs
- EnumerationRangeValidationUtil.cs
- SchemaCollectionCompiler.cs
- SkipStoryboardToFill.cs
- listitem.cs
- ZoneButton.cs
- SecurityDescriptor.cs
- BinaryFormatterWriter.cs
- SQLByteStorage.cs
- FileVersionInfo.cs
- DataGridPageChangedEventArgs.cs
- CqlIdentifiers.cs
- SHA512CryptoServiceProvider.cs
- CorrelationManager.cs
- XamlToRtfWriter.cs
- assertwrapper.cs
- SweepDirectionValidation.cs
- httpserverutility.cs
- TypeContext.cs
- HybridDictionary.cs
- UInt64Converter.cs
- DetailsViewCommandEventArgs.cs
- UnsafePeerToPeerMethods.cs
- RSAPKCS1KeyExchangeFormatter.cs
- LineInfo.cs
- MessageQueuePermission.cs
- ClientRoleProvider.cs
- XmlLanguageConverter.cs
- MaskedTextBox.cs
- GetPageCompletedEventArgs.cs
- XmlSchemaValidator.cs
- DynamicObject.cs
- TdsEnums.cs
- IndependentlyAnimatedPropertyMetadata.cs
- StrokeCollection.cs