Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Administration / WebAdminConfigurationHelper.cs / 1305376 / 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
- AutoCompleteStringCollection.cs
- FontStretchConverter.cs
- TransformProviderWrapper.cs
- SoapTypeAttribute.cs
- IDispatchConstantAttribute.cs
- NavigationCommands.cs
- WebPartAddingEventArgs.cs
- Point4DConverter.cs
- ISAPIRuntime.cs
- MatrixTransform.cs
- ToolStripSeparator.cs
- RawStylusInputReport.cs
- SendOperation.cs
- SchemaElementDecl.cs
- MessageDecoder.cs
- Matrix3DConverter.cs
- ADMembershipUser.cs
- WeakEventTable.cs
- HttpStreamXmlDictionaryWriter.cs
- SoundPlayer.cs
- LinqDataSourceContextData.cs
- ErrorInfoXmlDocument.cs
- ECDsa.cs
- SchemaMapping.cs
- SafeFileMappingHandle.cs
- DecoderFallback.cs
- StructureChangedEventArgs.cs
- EventProviderWriter.cs
- RadioButtonDesigner.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- XmlElementAttributes.cs
- UnsafeNativeMethods.cs
- UniqueEventHelper.cs
- Receive.cs
- MailHeaderInfo.cs
- DependsOnAttribute.cs
- Propagator.Evaluator.cs
- ContentType.cs
- ObjectManager.cs
- EventItfInfo.cs
- BamlStream.cs
- Focus.cs
- CodeDirectiveCollection.cs
- DocumentCollection.cs
- SmiEventStream.cs
- CodeIdentifier.cs
- LogExtent.cs
- FileAccessException.cs
- SimpleLine.cs
- PathSegmentCollection.cs
- CodeTypeMember.cs
- DescendantOverDescendantQuery.cs
- SqlUtils.cs
- DispatcherHooks.cs
- RsaKeyGen.cs
- ApplicationServicesHostFactory.cs
- OdbcCommand.cs
- InOutArgument.cs
- ElasticEase.cs
- ResourceContainer.cs
- XmlBinaryReader.cs
- webeventbuffer.cs
- Int32CAMarshaler.cs
- ReadOnlyDictionary.cs
- FontResourceCache.cs
- DeviceSpecific.cs
- NamespaceList.cs
- DEREncoding.cs
- ClientCredentials.cs
- MetadataArtifactLoaderCompositeResource.cs
- XmlLinkedNode.cs
- TextBox.cs
- DBAsyncResult.cs
- TextBoxAutoCompleteSourceConverter.cs
- HttpWriter.cs
- Renderer.cs
- MenuItem.cs
- GeneratedView.cs
- DataRecordInfo.cs
- DecimalAverageAggregationOperator.cs
- ByteStreamGeometryContext.cs
- PlaceHolder.cs
- StorageEntitySetMapping.cs
- RemoteWebConfigurationHostServer.cs
- TemplateControlCodeDomTreeGenerator.cs
- DataRelationCollection.cs
- PassportAuthenticationEventArgs.cs
- PriorityQueue.cs
- EditableLabelControl.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- PropertyPathConverter.cs
- MulticastIPAddressInformationCollection.cs
- CodeLinePragma.cs
- CommandID.cs
- EdgeModeValidation.cs
- WhitespaceRuleReader.cs
- NullRuntimeConfig.cs
- HtmlInputReset.cs
- ActivitiesCollection.cs
- Socket.cs