SimpleHandlerFactory.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / SimpleHandlerFactory.cs / 4 / SimpleHandlerFactory.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

/* 
 * Handler Factory implementation for ASP.NET files 
 *
 * Copyright (c) 2000 Microsoft Corporation 
 */

namespace System.Web.UI {
 
using System;
using System.Web.Compilation; 
using Debug = System.Web.Util.Debug; 

/* 
 * Handler Factory implementation for ASP.NET files
 */
internal class SimpleHandlerFactory : IHttpHandlerFactory2 {
    internal SimpleHandlerFactory() { 
    }
 
    public virtual IHttpHandler GetHandler(HttpContext context, string requestType, 
        string virtualPath, string path) {
 
        // This should never get called
        //Debug.Assert(false);

        return ((IHttpHandlerFactory2)this).GetHandler(context, requestType, 
            VirtualPath.CreateNonRelative(virtualPath), path);
    } 
 
    IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType,
        VirtualPath virtualPath, String physicalPath) { 

        BuildResultCompiledType result = (BuildResultCompiledType)BuildManager.GetVPathBuildResult(
            context, virtualPath);
 
        // Make sure the type has the correct base class (ASURT 123677)
        Util.CheckAssignableType(typeof(IHttpHandler), result.ResultType); 
 
        return (IHttpHandler) result.CreateInstance();
    } 

    public virtual void ReleaseHandler(IHttpHandler handler) {
    }
} 

} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

/* 
 * Handler Factory implementation for ASP.NET files 
 *
 * Copyright (c) 2000 Microsoft Corporation 
 */

namespace System.Web.UI {
 
using System;
using System.Web.Compilation; 
using Debug = System.Web.Util.Debug; 

/* 
 * Handler Factory implementation for ASP.NET files
 */
internal class SimpleHandlerFactory : IHttpHandlerFactory2 {
    internal SimpleHandlerFactory() { 
    }
 
    public virtual IHttpHandler GetHandler(HttpContext context, string requestType, 
        string virtualPath, string path) {
 
        // This should never get called
        //Debug.Assert(false);

        return ((IHttpHandlerFactory2)this).GetHandler(context, requestType, 
            VirtualPath.CreateNonRelative(virtualPath), path);
    } 
 
    IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType,
        VirtualPath virtualPath, String physicalPath) { 

        BuildResultCompiledType result = (BuildResultCompiledType)BuildManager.GetVPathBuildResult(
            context, virtualPath);
 
        // Make sure the type has the correct base class (ASURT 123677)
        Util.CheckAssignableType(typeof(IHttpHandler), result.ResultType); 
 
        return (IHttpHandler) result.CreateInstance();
    } 

    public virtual void ReleaseHandler(IHttpHandler handler) {
    }
} 

} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK