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
- GroupByExpressionRewriter.cs
- WebPartDeleteVerb.cs
- TreeViewHitTestInfo.cs
- WindowsImpersonationContext.cs
- SoapAttributeAttribute.cs
- SizeF.cs
- SqlNotificationRequest.cs
- CodeCommentStatementCollection.cs
- LogAppendAsyncResult.cs
- EntityExpressionVisitor.cs
- HttpGetProtocolImporter.cs
- CountdownEvent.cs
- ReadOnlyHierarchicalDataSourceView.cs
- EncodedStreamFactory.cs
- LayoutEvent.cs
- TraceLevelStore.cs
- RuntimeConfig.cs
- EmbeddedMailObject.cs
- Win32SafeHandles.cs
- listitem.cs
- DataColumnMapping.cs
- ResourceReader.cs
- AddressingVersion.cs
- XmlMtomWriter.cs
- AutomationPatternInfo.cs
- OleDbDataAdapter.cs
- SqlServer2KCompatibilityAnnotation.cs
- BrushValueSerializer.cs
- SchemaDeclBase.cs
- SmtpNtlmAuthenticationModule.cs
- BitmapFrameDecode.cs
- RepeaterCommandEventArgs.cs
- tabpagecollectioneditor.cs
- IsolatedStoragePermission.cs
- MenuRendererClassic.cs
- TimeoutHelper.cs
- ActivityTypeCodeDomSerializer.cs
- UserValidatedEventArgs.cs
- BaseEntityWrapper.cs
- DataFormat.cs
- ScrollChrome.cs
- ActivityWithResult.cs
- SQLConvert.cs
- PowerModeChangedEventArgs.cs
- Console.cs
- NativeWrapper.cs
- FamilyMap.cs
- ErrorWebPart.cs
- GridProviderWrapper.cs
- BaseTemplateCodeDomTreeGenerator.cs
- ActivityStateQuery.cs
- ComNativeDescriptor.cs
- FocusWithinProperty.cs
- HuffmanTree.cs
- TextServicesDisplayAttributePropertyRanges.cs
- CodeNamespaceCollection.cs
- ProcessModelSection.cs
- SuppressedPackageProperties.cs
- RegexCaptureCollection.cs
- SizeAnimationUsingKeyFrames.cs
- DataFormat.cs
- ProxyWebPartConnectionCollection.cs
- RelationshipFixer.cs
- SessionParameter.cs
- ExpressionBuilder.cs
- DataSourceGroupCollection.cs
- WebResourceAttribute.cs
- WindowsFormsHost.cs
- SQLStringStorage.cs
- Msec.cs
- MailBnfHelper.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- contentDescriptor.cs
- OleDbDataAdapter.cs
- WebPart.cs
- InstalledVoice.cs
- SiblingIterators.cs
- ClientRuntimeConfig.cs
- KeyEventArgs.cs
- HostExecutionContextManager.cs
- StaticDataManager.cs
- UIElement.cs
- SoapIgnoreAttribute.cs
- PartBasedPackageProperties.cs
- MultipartIdentifier.cs
- DictionaryEntry.cs
- XPathEmptyIterator.cs
- TemplateBuilder.cs
- CharUnicodeInfo.cs
- DataViewSettingCollection.cs
- DataView.cs
- PriorityBinding.cs
- InputGestureCollection.cs
- DeviceContext.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- MetadataArtifactLoaderCompositeResource.cs
- Panel.cs
- HtmlImage.cs
- BitmapInitialize.cs
- diagnosticsswitches.cs