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
- SplineQuaternionKeyFrame.cs
- XPathSelfQuery.cs
- NegationPusher.cs
- InvalidComObjectException.cs
- BuiltInExpr.cs
- Signature.cs
- TTSEvent.cs
- ClientConfigPaths.cs
- TemplateInstanceAttribute.cs
- SqlGenerator.cs
- HtmlInputPassword.cs
- ChannelServices.cs
- ZoneIdentityPermission.cs
- EntityDataSourceSelectingEventArgs.cs
- TextRangeBase.cs
- SqlConnectionPoolProviderInfo.cs
- LoginDesigner.cs
- ControlParameter.cs
- DebugManager.cs
- EventSinkHelperWriter.cs
- ListChangedEventArgs.cs
- Emitter.cs
- TreeNodeCollection.cs
- EntityContainerAssociationSetEnd.cs
- HashMembershipCondition.cs
- Baml2006KeyRecord.cs
- IApplicationTrustManager.cs
- Menu.cs
- SoapMessage.cs
- BooleanAnimationBase.cs
- TextRunTypographyProperties.cs
- AlternateViewCollection.cs
- WindowPatternIdentifiers.cs
- AdCreatedEventArgs.cs
- ToolStripLocationCancelEventArgs.cs
- Transform.cs
- SpellCheck.cs
- SurrogateEncoder.cs
- XPathChildIterator.cs
- WebPermission.cs
- FontInfo.cs
- DataSourceXmlSubItemAttribute.cs
- ConfigurationManager.cs
- EmptyStringExpandableObjectConverter.cs
- PropertyChangeTracker.cs
- Base64Encoder.cs
- AppDomainFactory.cs
- BooleanExpr.cs
- ActivityValidator.cs
- XsltConvert.cs
- ParsedAttributeCollection.cs
- SpecialFolderEnumConverter.cs
- Message.cs
- XPathScanner.cs
- SQLGuid.cs
- OleDbEnumerator.cs
- MD5Cng.cs
- ExceptionUtil.cs
- ClipboardProcessor.cs
- WebBrowserPermission.cs
- PolyQuadraticBezierSegment.cs
- SmiEventSink_Default.cs
- UnmanagedHandle.cs
- ToolStripItemClickedEventArgs.cs
- PasswordTextNavigator.cs
- ServerProtocol.cs
- UrlMapping.cs
- PowerModeChangedEventArgs.cs
- ResolveNameEventArgs.cs
- XmlAttributes.cs
- FontCacheLogic.cs
- TreeIterator.cs
- BaseParagraph.cs
- DataSourceXmlSubItemAttribute.cs
- AuthenticationException.cs
- MarkupCompilePass2.cs
- JapaneseCalendar.cs
- CacheDependency.cs
- TreeNodeEventArgs.cs
- Int32Storage.cs
- ScrollPattern.cs
- XmlDataLoader.cs
- OperandQuery.cs
- DataSetMappper.cs
- GeneralTransform3DGroup.cs
- BindMarkupExtensionSerializer.cs
- ConnectionManagementSection.cs
- HttpConfigurationContext.cs
- HttpConfigurationContext.cs
- ContractCodeDomInfo.cs
- BrowserCapabilitiesCompiler.cs
- BindingListCollectionView.cs
- basecomparevalidator.cs
- ChannelSinkStacks.cs
- HtmlLink.cs
- SynchronizedInputPattern.cs
- Walker.cs
- shaperfactoryquerycacheentry.cs
- DescriptionAttribute.cs
- Attributes.cs