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
- ServerIdentity.cs
- IPGlobalProperties.cs
- EntityContainerRelationshipSetEnd.cs
- MdImport.cs
- RemotingSurrogateSelector.cs
- DataServices.cs
- ScriptControlManager.cs
- JpegBitmapDecoder.cs
- SchemaImporterExtensionElementCollection.cs
- MatchingStyle.cs
- ByteStack.cs
- PartialCachingAttribute.cs
- FillErrorEventArgs.cs
- columnmapkeybuilder.cs
- ObjectParameter.cs
- DbConnectionStringBuilder.cs
- SamlSerializer.cs
- DBCSCodePageEncoding.cs
- CapabilitiesRule.cs
- DataObject.cs
- ExpressionPrefixAttribute.cs
- EdmScalarPropertyAttribute.cs
- TraceListeners.cs
- CollectionViewGroupRoot.cs
- ToolStripContainer.cs
- SettingsAttributeDictionary.cs
- StackBuilderSink.cs
- GradientStop.cs
- PolicyLevel.cs
- LookupBindingPropertiesAttribute.cs
- control.ime.cs
- ReceiveMessageRecord.cs
- ObjectViewListener.cs
- XmlDocumentSerializer.cs
- CfgRule.cs
- SqlAliaser.cs
- DataServiceHostFactory.cs
- ModuleConfigurationInfo.cs
- XPathPatternParser.cs
- ExcCanonicalXml.cs
- TagMapInfo.cs
- ClientConvert.cs
- CommonGetThemePartSize.cs
- RotateTransform3D.cs
- ElementUtil.cs
- DBSchemaTable.cs
- ChannelCredentials.cs
- XmlTypeAttribute.cs
- ActivitiesCollection.cs
- Normalization.cs
- DataGridViewRowCollection.cs
- StickyNote.cs
- ColorAnimationUsingKeyFrames.cs
- XmlSchemaAttribute.cs
- Debug.cs
- _ConnectStream.cs
- WebPartUserCapability.cs
- XmlUtil.cs
- ParenthesizePropertyNameAttribute.cs
- LinkedList.cs
- RangeValueProviderWrapper.cs
- PolicyManager.cs
- HelloOperation11AsyncResult.cs
- AstTree.cs
- XmlHelper.cs
- AtomMaterializer.cs
- KeyConverter.cs
- DataGridParentRows.cs
- SafeCryptHandles.cs
- SimpleHandlerFactory.cs
- TextRangeSerialization.cs
- OleDbException.cs
- WSTrustFeb2005.cs
- GlobalAllocSafeHandle.cs
- InvokeGenerator.cs
- InvalidFilterCriteriaException.cs
- SqlBuilder.cs
- BinaryKeyIdentifierClause.cs
- CommonBehaviorsSection.cs
- BitmapMetadataBlob.cs
- EventMemberCodeDomSerializer.cs
- BitmapScalingModeValidation.cs
- FlowDocumentReaderAutomationPeer.cs
- Set.cs
- SqlWriter.cs
- FileDialogCustomPlace.cs
- AssemblyResourceLoader.cs
- BinaryFormatter.cs
- ThreadInterruptedException.cs
- PolyQuadraticBezierSegment.cs
- CngKeyCreationParameters.cs
- WebContentFormatHelper.cs
- IntegerValidator.cs
- PatternMatcher.cs
- KeysConverter.cs
- QilPatternVisitor.cs
- SingleResultAttribute.cs
- XmlSignificantWhitespace.cs
- StateMachineHelpers.cs
- LockCookie.cs