Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MatrixConverter.cs
- XmlChoiceIdentifierAttribute.cs
- MappingSource.cs
- WsatAdminException.cs
- DeflateStreamAsyncResult.cs
- MulticastNotSupportedException.cs
- PropertyConverter.cs
- StateFinalizationActivity.cs
- FileSystemWatcher.cs
- CallContext.cs
- TabletDevice.cs
- Stroke2.cs
- SharedRuntimeState.cs
- CaretElement.cs
- DbDataRecord.cs
- CorrelationTokenTypeConvertor.cs
- Polyline.cs
- SpinLock.cs
- assemblycache.cs
- HttpConfigurationContext.cs
- FamilyTypefaceCollection.cs
- EntityDataSourceWizardForm.cs
- RepeaterItemCollection.cs
- HttpTransportElement.cs
- BaseProcessor.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- EncryptedPackage.cs
- LicenseManager.cs
- SubMenuStyle.cs
- XmlSortKeyAccumulator.cs
- LineServicesRun.cs
- TypedTableBase.cs
- Encoder.cs
- IOException.cs
- _TimerThread.cs
- AutoGeneratedField.cs
- X509Extension.cs
- CodePageUtils.cs
- ToolboxBitmapAttribute.cs
- BaseCodeDomTreeGenerator.cs
- KnownTypesProvider.cs
- BlurEffect.cs
- userdatakeys.cs
- PackageProperties.cs
- RuntimeConfigLKG.cs
- XDeferredAxisSource.cs
- AutomationFocusChangedEventArgs.cs
- PenContexts.cs
- EmptyElement.cs
- PersonalizationStateInfoCollection.cs
- FormClosedEvent.cs
- HostProtectionException.cs
- Renderer.cs
- PropertyEntry.cs
- ValueHandle.cs
- GroupedContextMenuStrip.cs
- SettingsAttributes.cs
- OleDbConnectionInternal.cs
- BindingBase.cs
- EntityContainerAssociationSetEnd.cs
- ServiceReference.cs
- ClientSettingsProvider.cs
- CultureInfoConverter.cs
- XmlSchemaAnyAttribute.cs
- WpfMemberInvoker.cs
- OverflowException.cs
- EntitySetDataBindingList.cs
- RegionIterator.cs
- NameHandler.cs
- Speller.cs
- FontUnitConverter.cs
- ObjectDataSourceView.cs
- SoapUnknownHeader.cs
- RangeExpression.cs
- Translator.cs
- keycontainerpermission.cs
- WorkflowRuntimeService.cs
- ResourceWriter.cs
- ServiceContractViewControl.cs
- XmlPreloadedResolver.cs
- ZipIOExtraFieldElement.cs
- HwndSourceParameters.cs
- GcHandle.cs
- HiddenFieldPageStatePersister.cs
- SpellerHighlightLayer.cs
- SqlDataAdapter.cs
- AnimatedTypeHelpers.cs
- NamespaceDecl.cs
- OleDbRowUpdatedEvent.cs
- Int32AnimationBase.cs
- PointLightBase.cs
- WebPartTransformerAttribute.cs
- UpdateEventArgs.cs
- ToolBarTray.cs
- ClientSettingsStore.cs
- BinaryOperationBinder.cs
- PropertyKey.cs
- DockPanel.cs
- DetailsViewRow.cs
- MimeMultiPart.cs