Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / Administration / WebAdminConfigurationHelper.cs / 1 / 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. // //----------------------------------------------------------------------------- /************************************************************************************************************/ 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
- CompositionCommandSet.cs
- DropDownList.cs
- HtmlGenericControl.cs
- WeakReadOnlyCollection.cs
- SafeCryptHandles.cs
- SQLByte.cs
- AffineTransform3D.cs
- JavaScriptObjectDeserializer.cs
- XmlSubtreeReader.cs
- ResourceDescriptionAttribute.cs
- PTConverter.cs
- OLEDB_Enum.cs
- PerformanceCounterLib.cs
- TextEditorLists.cs
- DataKeyCollection.cs
- DbModificationClause.cs
- ObjectSet.cs
- ChtmlTextWriter.cs
- AspNetCompatibilityRequirementsAttribute.cs
- SecurityCriticalDataForSet.cs
- SimpleType.cs
- RawTextInputReport.cs
- updateconfighost.cs
- AppSettingsSection.cs
- GenericQueueSurrogate.cs
- ContextMarshalException.cs
- _BufferOffsetSize.cs
- SimpleMailWebEventProvider.cs
- OleDbCommand.cs
- ValidatingReaderNodeData.cs
- SchemaAttDef.cs
- OdbcConnectionString.cs
- MaskedTextProvider.cs
- WindowsScrollBar.cs
- HotSpotCollectionEditor.cs
- ImageFormat.cs
- BooleanExpr.cs
- TemplatingOptionsDialog.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- RowTypePropertyElement.cs
- UnsafeNativeMethodsMilCoreApi.cs
- DataRelationCollection.cs
- QilGeneratorEnv.cs
- MemberListBinding.cs
- SchemaSetCompiler.cs
- DispatchWrapper.cs
- EventMappingSettings.cs
- GeometryHitTestParameters.cs
- SafeNativeMethods.cs
- OneOfScalarConst.cs
- HwndSource.cs
- PackagePart.cs
- SystemNetHelpers.cs
- InstanceLockedException.cs
- SqlBooleanMismatchVisitor.cs
- MimeTypeAttribute.cs
- BinaryOperationBinder.cs
- RoleManagerEventArgs.cs
- AutomationFocusChangedEventArgs.cs
- ToolStripHighContrastRenderer.cs
- Quaternion.cs
- ApplicationInfo.cs
- BamlResourceContent.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- Size3D.cs
- COM2IDispatchConverter.cs
- TextDpi.cs
- DataServiceSaveChangesEventArgs.cs
- DbDataReader.cs
- Compensation.cs
- Rect.cs
- PropertyInfoSet.cs
- EncoderFallback.cs
- ConnectionStringsExpressionBuilder.cs
- MessageSecurityVersionConverter.cs
- CanonicalizationDriver.cs
- DataTableCollection.cs
- HtmlInputText.cs
- ColorKeyFrameCollection.cs
- HTMLTagNameToTypeMapper.cs
- TextSegment.cs
- RtType.cs
- UnsafeNativeMethods.cs
- Compress.cs
- DiscreteKeyFrames.cs
- WebBrowserUriTypeConverter.cs
- RTLAwareMessageBox.cs
- ArrayExtension.cs
- InputScopeConverter.cs
- PlacementWorkspace.cs
- FormParameter.cs
- SiteMapNode.cs
- TextEndOfLine.cs
- Simplifier.cs
- QilXmlReader.cs
- SqlNodeTypeOperators.cs
- DataGridHelper.cs
- UrlMappingsModule.cs
- AxHost.cs
- JoinGraph.cs