Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ISCIIEncoding.cs
- Menu.cs
- PrintDialogDesigner.cs
- AuthenticateEventArgs.cs
- MasterPageCodeDomTreeGenerator.cs
- ChangeConflicts.cs
- OleDbReferenceCollection.cs
- ToolStripContentPanel.cs
- ValidatorCompatibilityHelper.cs
- ObjectQueryProvider.cs
- BitmapCache.cs
- ConnectionManagementSection.cs
- ObjectItemAttributeAssemblyLoader.cs
- ImageButton.cs
- EnumValidator.cs
- RunInstallerAttribute.cs
- ContextQuery.cs
- ConnectionInterfaceCollection.cs
- MatrixKeyFrameCollection.cs
- ProtocolViolationException.cs
- NativeMethodsOther.cs
- MonthCalendarDesigner.cs
- TraceUtility.cs
- SmiEventSink.cs
- ToolStripDropDownButton.cs
- Invariant.cs
- Stream.cs
- PageCache.cs
- ApplicationDirectoryMembershipCondition.cs
- ForeignKeyFactory.cs
- XhtmlConformanceSection.cs
- PageParser.cs
- ScriptControlDescriptor.cs
- CheckoutException.cs
- MouseCaptureWithinProperty.cs
- LambdaValue.cs
- Tag.cs
- ImmutableObjectAttribute.cs
- HtmlTableRow.cs
- X509DefaultServiceCertificateElement.cs
- LowerCaseStringConverter.cs
- TableLayoutSettingsTypeConverter.cs
- XmlIlVisitor.cs
- AutomationPropertyInfo.cs
- ProfileBuildProvider.cs
- InfoCardRSACryptoProvider.cs
- DataObjectSettingDataEventArgs.cs
- HtmlInputFile.cs
- Section.cs
- ValueConversionAttribute.cs
- EraserBehavior.cs
- Int32CollectionConverter.cs
- FormViewDeleteEventArgs.cs
- StaticDataManager.cs
- OdbcPermission.cs
- EmptyCollection.cs
- ProtocolsSection.cs
- PersonalizationState.cs
- MetabaseServerConfig.cs
- BinaryObjectInfo.cs
- StructuredTypeInfo.cs
- ArrayElementGridEntry.cs
- WaitHandle.cs
- MonitoringDescriptionAttribute.cs
- CodeStatementCollection.cs
- Int32CollectionValueSerializer.cs
- SqlErrorCollection.cs
- MetabaseServerConfig.cs
- RegistrySecurity.cs
- ScopedKnownTypes.cs
- NameValueConfigurationCollection.cs
- CharacterBufferReference.cs
- HashCoreRequest.cs
- HiddenFieldPageStatePersister.cs
- EntityProxyTypeInfo.cs
- UInt64Storage.cs
- XmlDocumentSerializer.cs
- _LocalDataStore.cs
- DataGridRelationshipRow.cs
- SqlBulkCopyColumnMappingCollection.cs
- SecureConversationSecurityTokenParameters.cs
- XmlNullResolver.cs
- ActivitySurrogate.cs
- ControlUtil.cs
- XPathPatternParser.cs
- SynchronousChannelMergeEnumerator.cs
- QilLiteral.cs
- MetadataPropertyAttribute.cs
- PropertyMapper.cs
- DrawingServices.cs
- SerializationInfo.cs
- ControlDesigner.cs
- SqlIdentifier.cs
- LocalBuilder.cs
- Action.cs
- ReadContentAsBinaryHelper.cs
- BitmapMetadataEnumerator.cs
- SqlDataSourceQueryEditor.cs
- ExtenderProvidedPropertyAttribute.cs
- TreePrinter.cs