Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / PageHandlerFactory.cs / 3 / PageHandlerFactory.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * Handler Factory implementation for Page files * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.UI { using System.Runtime.Serialization.Formatters; using System.IO; using System.Security.Permissions; using System.Web.Compilation; using System.Web.Util; using Debug=System.Web.Util.Debug; /* * Handler Factory implementation for ASP.NET files */ [PermissionSet(SecurityAction.LinkDemand, Unrestricted = true)] [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted=true)] public class PageHandlerFactory : IHttpHandlerFactory2 { private bool _isInheritedInstance; protected internal PageHandlerFactory() { // Check whether this is the exact PageHandlerFactory, or a derived class _isInheritedInstance = (GetType() != typeof(PageHandlerFactory)); } public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string virtualPath, string path) { Debug.Trace("PageHandlerFactory", "PageHandlerFactory: " + virtualPath); // This should never get called in ISAPI mode but currently is in integrated mode // Debug.Assert(false); return GetHandlerHelper(context, requestType, VirtualPath.CreateNonRelative(virtualPath), path); } IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) { // If it's a derived class, we must call the old (less efficient) GetHandler, in // case it was overriden if (_isInheritedInstance) { return GetHandler(context, requestType, virtualPath.VirtualPathString, physicalPath); } return GetHandlerHelper(context, requestType, virtualPath, physicalPath); } public virtual void ReleaseHandler(IHttpHandler handler) { } private IHttpHandler GetHandlerHelper(HttpContext context, string requestType, VirtualPath virtualPath, string physicalPath) { Page page = BuildManager.CreateInstanceFromVirtualPath( virtualPath, typeof(Page), context, true /*allowCrossApp*/, true /*noAssert*/) as Page; if (page == null) return null; page.TemplateControlVirtualPath = virtualPath; return page; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * Handler Factory implementation for Page files * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.UI { using System.Runtime.Serialization.Formatters; using System.IO; using System.Security.Permissions; using System.Web.Compilation; using System.Web.Util; using Debug=System.Web.Util.Debug; /* * Handler Factory implementation for ASP.NET files */ [PermissionSet(SecurityAction.LinkDemand, Unrestricted = true)] [PermissionSet(SecurityAction.InheritanceDemand, Unrestricted=true)] public class PageHandlerFactory : IHttpHandlerFactory2 { private bool _isInheritedInstance; protected internal PageHandlerFactory() { // Check whether this is the exact PageHandlerFactory, or a derived class _isInheritedInstance = (GetType() != typeof(PageHandlerFactory)); } public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string virtualPath, string path) { Debug.Trace("PageHandlerFactory", "PageHandlerFactory: " + virtualPath); // This should never get called in ISAPI mode but currently is in integrated mode // Debug.Assert(false); return GetHandlerHelper(context, requestType, VirtualPath.CreateNonRelative(virtualPath), path); } IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) { // If it's a derived class, we must call the old (less efficient) GetHandler, in // case it was overriden if (_isInheritedInstance) { return GetHandler(context, requestType, virtualPath.VirtualPathString, physicalPath); } return GetHandlerHelper(context, requestType, virtualPath, physicalPath); } public virtual void ReleaseHandler(IHttpHandler handler) { } private IHttpHandler GetHandlerHelper(HttpContext context, string requestType, VirtualPath virtualPath, string physicalPath) { Page page = BuildManager.CreateInstanceFromVirtualPath( virtualPath, typeof(Page), context, true /*allowCrossApp*/, true /*noAssert*/) as Page; if (page == null) return null; page.TemplateControlVirtualPath = virtualPath; return page; } } } // 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
- SystemThemeKey.cs
- ToolStripGripRenderEventArgs.cs
- CollectionViewProxy.cs
- EventDescriptorCollection.cs
- BindToObject.cs
- BindingMemberInfo.cs
- AppSettingsReader.cs
- RenderData.cs
- PageAdapter.cs
- SoundPlayerAction.cs
- IQueryable.cs
- CustomError.cs
- StructuredTypeEmitter.cs
- MetadataCache.cs
- DocumentCollection.cs
- DataGridBoolColumn.cs
- TrustManagerPromptUI.cs
- Iis7Helper.cs
- ImmComposition.cs
- ActivityInstanceReference.cs
- SqlComparer.cs
- GlyphShapingProperties.cs
- DocumentViewerConstants.cs
- HttpProfileBase.cs
- ConstraintConverter.cs
- WebConfigurationManager.cs
- AssemblyGen.cs
- unsafenativemethodstextservices.cs
- StreamReader.cs
- HttpWebRequest.cs
- DataTableClearEvent.cs
- SiteMapHierarchicalDataSourceView.cs
- GridEntry.cs
- XmlUtil.cs
- FieldInfo.cs
- NativeRecognizer.cs
- Int32CollectionConverter.cs
- MiniCustomAttributeInfo.cs
- SystemGatewayIPAddressInformation.cs
- FaultContractInfo.cs
- CreateUserErrorEventArgs.cs
- XamlWriter.cs
- AnimationClock.cs
- GeneralTransform3DTo2DTo3D.cs
- EventProviderBase.cs
- ExpressionEditorAttribute.cs
- Root.cs
- JumpTask.cs
- AttachInfo.cs
- UserUseLicenseDictionaryLoader.cs
- BaseTransportHeaders.cs
- HwndSubclass.cs
- WebPartDisplayMode.cs
- NavigationProperty.cs
- Color.cs
- SecurityContextSecurityTokenAuthenticator.cs
- CategoryNameCollection.cs
- EventTrigger.cs
- ClickablePoint.cs
- GridView.cs
- SQlBooleanStorage.cs
- HtmlFormWrapper.cs
- StylusCaptureWithinProperty.cs
- EmissiveMaterial.cs
- AddDataControlFieldDialog.cs
- FileAuthorizationModule.cs
- AppDomainUnloadedException.cs
- SimpleType.cs
- WindowsListViewItemStartMenu.cs
- OptimizedTemplateContent.cs
- CodeObjectCreateExpression.cs
- ToolbarAUtomationPeer.cs
- StringCollectionEditor.cs
- RawMouseInputReport.cs
- HttpCachePolicyElement.cs
- DbCommandDefinition.cs
- EventArgs.cs
- SizeAnimationClockResource.cs
- SrgsElementFactoryCompiler.cs
- TreeNodeStyleCollection.cs
- wmiprovider.cs
- ComplexObject.cs
- ToolBarOverflowPanel.cs
- FontEmbeddingManager.cs
- SkewTransform.cs
- Rijndael.cs
- ColorConvertedBitmap.cs
- BrowserCapabilitiesCodeGenerator.cs
- Grammar.cs
- WSHttpTransportSecurityElement.cs
- ExeContext.cs
- ReachPageContentSerializer.cs
- ProxyHelper.cs
- SystemInformation.cs
- SoapIncludeAttribute.cs
- MachinePropertyVariants.cs
- Int64AnimationBase.cs
- Comparer.cs
- DNS.cs
- ChannelManager.cs