Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / PageHandlerFactory.cs / 1305376 / 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*/) as Page;
if (page == null)
return null;
page.TemplateControlVirtualPath = virtualPath;
return page;
}
}
}
// 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
- InheritanceService.cs
- GenericUI.cs
- ToolStripItemEventArgs.cs
- GetWorkflowTree.cs
- BindingNavigator.cs
- BitmapDecoder.cs
- ConfigsHelper.cs
- util.cs
- AssociatedControlConverter.cs
- PowerModeChangedEventArgs.cs
- util.cs
- InkPresenter.cs
- ColumnResizeUndoUnit.cs
- Socket.cs
- X509ChainElement.cs
- WorkflowFileItem.cs
- DiscoveryEndpointElement.cs
- SmtpDigestAuthenticationModule.cs
- Token.cs
- Column.cs
- OptimalTextSource.cs
- ConcurrencyMode.cs
- httpapplicationstate.cs
- DataGridDetailsPresenterAutomationPeer.cs
- GeneralTransform3DTo2DTo3D.cs
- DataGridPagingPage.cs
- ListViewItem.cs
- ConfigurationSettings.cs
- RequiredFieldValidator.cs
- EndpointReference.cs
- ClientProtocol.cs
- AVElementHelper.cs
- ListBindableAttribute.cs
- XmlLangPropertyAttribute.cs
- GroupItemAutomationPeer.cs
- LinqDataSourceContextEventArgs.cs
- PartialArray.cs
- HostingEnvironment.cs
- ParserHooks.cs
- BufferBuilder.cs
- CommandBindingCollection.cs
- Message.cs
- NameValuePermission.cs
- ZipIOExtraField.cs
- Interop.cs
- Stream.cs
- TextDecoration.cs
- XmlC14NWriter.cs
- SqlConnection.cs
- SmiConnection.cs
- DetailsViewUpdateEventArgs.cs
- DelegatingTypeDescriptionProvider.cs
- PeerNameResolver.cs
- EntityDataSourceStatementEditorForm.cs
- BypassElementCollection.cs
- HMACRIPEMD160.cs
- mediaeventargs.cs
- DataGridViewComboBoxColumn.cs
- RangeValuePatternIdentifiers.cs
- HttpChannelHelpers.cs
- EncryptedPackage.cs
- KeyBinding.cs
- SqlFunctionAttribute.cs
- TdsEnums.cs
- Stroke.cs
- XmlCollation.cs
- ParallelTimeline.cs
- ByteStream.cs
- TemplatedWizardStep.cs
- AnonymousIdentificationModule.cs
- UpdatePanelTrigger.cs
- JsonGlobals.cs
- ThemeableAttribute.cs
- ComponentDispatcher.cs
- ListBindingHelper.cs
- WebBrowserHelper.cs
- PreservationFileReader.cs
- CompilationLock.cs
- XmlAttributeAttribute.cs
- CharacterBuffer.cs
- WebBrowsableAttribute.cs
- PropertyDescriptorComparer.cs
- MenuItemCollection.cs
- login.cs
- NavigationProgressEventArgs.cs
- DockingAttribute.cs
- DataGridViewRowsRemovedEventArgs.cs
- RichTextBoxAutomationPeer.cs
- XPathDocument.cs
- ExpressionEditorSheet.cs
- XmlIlGenerator.cs
- ApplicationGesture.cs
- DataGridViewCell.cs
- LocatorManager.cs
- AddInController.cs
- TextEmbeddedObject.cs
- LineServicesCallbacks.cs
- DataListItem.cs
- DataBoundControlAdapter.cs
- CustomErrorsSection.cs