Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Administration / WebAdminConfigurationHelper.cs / 2 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConnectionInterfaceCollection.cs
- Size.cs
- ProgressiveCrcCalculatingStream.cs
- BamlRecordReader.cs
- FormCollection.cs
- TextEditorTyping.cs
- DataGridDesigner.cs
- ServiceDocumentFormatter.cs
- ThreadExceptionEvent.cs
- HostedImpersonationContext.cs
- CompositeFontFamily.cs
- CryptoProvider.cs
- EditorZoneBase.cs
- WebPartUtil.cs
- MembershipPasswordException.cs
- XPathNodeHelper.cs
- DataRelationCollection.cs
- ScrollViewer.cs
- PropertyCondition.cs
- ComboBoxAutomationPeer.cs
- UnauthorizedWebPart.cs
- SQLDecimalStorage.cs
- codemethodreferenceexpression.cs
- RtfToXamlLexer.cs
- CodeDirectoryCompiler.cs
- dataSvcMapFileLoader.cs
- SerialErrors.cs
- ReadOnlyDataSource.cs
- BatchWriter.cs
- DataObjectPastingEventArgs.cs
- JavascriptCallbackBehaviorAttribute.cs
- SelectionRangeConverter.cs
- MenuBase.cs
- ControlBindingsCollection.cs
- IteratorFilter.cs
- CapabilitiesSection.cs
- QueryOperationResponseOfT.cs
- ToolStripRenderEventArgs.cs
- NotifyIcon.cs
- ElementAction.cs
- SequenceNumber.cs
- XmlSchemaAnyAttribute.cs
- CompiledXpathExpr.cs
- WindowsGrip.cs
- DataBoundControl.cs
- Module.cs
- UInt64Storage.cs
- RuntimeVariableList.cs
- ErrorActivity.cs
- BaseTreeIterator.cs
- DataGridTableCollection.cs
- SurrogateDataContract.cs
- Emitter.cs
- AsymmetricKeyExchangeFormatter.cs
- DynamicPropertyHolder.cs
- Restrictions.cs
- AddInAttribute.cs
- SqlUserDefinedTypeAttribute.cs
- SingleSelectRootGridEntry.cs
- OdbcConnectionPoolProviderInfo.cs
- DashStyle.cs
- SrgsDocument.cs
- _ProxyChain.cs
- Int16.cs
- ProviderUtil.cs
- GenericArgumentsUpdater.cs
- Bold.cs
- DbProviderServices.cs
- DynamicUpdateCommand.cs
- DBPropSet.cs
- TextStore.cs
- XmlWriter.cs
- DecoderNLS.cs
- _NetRes.cs
- AuthorizationSection.cs
- TextBounds.cs
- TreeView.cs
- safesecurityhelperavalon.cs
- documentsequencetextview.cs
- ScanQueryOperator.cs
- TableItemPatternIdentifiers.cs
- WindowsMenu.cs
- TransactionInterop.cs
- WebPartVerbsEventArgs.cs
- Button.cs
- FactoryGenerator.cs
- PageContentCollection.cs
- CounterCreationDataCollection.cs
- TypeRestriction.cs
- HtmlInputRadioButton.cs
- DataTemplate.cs
- DefinitionBase.cs
- SymbolDocumentInfo.cs
- WorkflowItemPresenter.cs
- XmlILConstructAnalyzer.cs
- TemplateEditingVerb.cs
- HashSet.cs
- TextTreeTextElementNode.cs
- AmbientLight.cs
- XmlChildEnumerator.cs