Code:
/ DotNET / DotNET / 8.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
- TypeKeyValue.cs
- ArraySegment.cs
- ExtentCqlBlock.cs
- AvTraceDetails.cs
- SortAction.cs
- FamilyMap.cs
- ProviderCollection.cs
- MetadataArtifactLoaderComposite.cs
- ToolStripHighContrastRenderer.cs
- DiscoveryRequestHandler.cs
- NavigateEvent.cs
- ScrollEvent.cs
- Restrictions.cs
- XsltFunctions.cs
- _TLSstream.cs
- TextPointer.cs
- ObjectHelper.cs
- BigInt.cs
- Hex.cs
- PageEventArgs.cs
- ScrollChrome.cs
- EmissiveMaterial.cs
- SmtpAuthenticationManager.cs
- QilPatternFactory.cs
- BindingExpressionUncommonField.cs
- ToolStripRenderer.cs
- AuthenticatedStream.cs
- WsatServiceAddress.cs
- X500Name.cs
- FontFamily.cs
- _UriSyntax.cs
- Model3DGroup.cs
- DataGridViewCellConverter.cs
- ToolStripSplitButton.cs
- _ProxyChain.cs
- LambdaCompiler.Logical.cs
- Visual3D.cs
- ObjectViewEntityCollectionData.cs
- Query.cs
- StringStorage.cs
- RepeatButtonAutomationPeer.cs
- XmlHierarchicalEnumerable.cs
- WindowsFormsEditorServiceHelper.cs
- PerformanceCounterPermission.cs
- RelatedCurrencyManager.cs
- ListControl.cs
- FastEncoder.cs
- TemplatedMailWebEventProvider.cs
- GeneralTransform3DCollection.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- View.cs
- MenuItemStyle.cs
- InvokeBinder.cs
- WorkflowCreationContext.cs
- HyperLinkField.cs
- ContainerFilterService.cs
- FloaterParaClient.cs
- PartialClassGenerationTaskInternal.cs
- DocumentApplicationState.cs
- DataGridViewCellValueEventArgs.cs
- FileAuthorizationModule.cs
- StrongNameMembershipCondition.cs
- SettingsPropertyIsReadOnlyException.cs
- WebPartConnectionsEventArgs.cs
- ConnectionModeReader.cs
- HeaderCollection.cs
- GlobalizationSection.cs
- CallbackHandler.cs
- DbConnectionClosed.cs
- ExpandCollapseIsCheckedConverter.cs
- SoapCodeExporter.cs
- WebPartTransformerCollection.cs
- WebZone.cs
- TextViewDesigner.cs
- FontStretches.cs
- ConfigViewGenerator.cs
- FileSecurity.cs
- DataGridTemplateColumn.cs
- EdmItemError.cs
- QilXmlReader.cs
- Globals.cs
- ResourceExpression.cs
- ThreadPool.cs
- Shared.cs
- securestring.cs
- ImmutableAssemblyCacheEntry.cs
- TypeUtils.cs
- DirectoryNotFoundException.cs
- Event.cs
- TcpChannelFactory.cs
- _DisconnectOverlappedAsyncResult.cs
- ListViewUpdateEventArgs.cs
- SoapTypeAttribute.cs
- Quaternion.cs
- ErrorEventArgs.cs
- SynchronizedDispatch.cs
- DataSourceCache.cs
- EventLogEntryCollection.cs
- SmiMetaData.cs