1 //------------------------------------------------------------------------------
2 // <copyright file="SimpleHandlerFactory.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //------------------------------------------------------------------------------
6 
7 /*
8  * Handler Factory implementation for ASP.NET files
9  *
10  * Copyright (c) 2000 Microsoft Corporation
11  */
12 
13 namespace System.Web.UI {
14 
15 using System;
16 using System.Web.Compilation;
17 using Debug = System.Web.Util.Debug;
18 
19 /*
20  * Handler Factory implementation for ASP.NET files
21  */
22 internal class SimpleHandlerFactory : IHttpHandlerFactory2 {
SimpleHandlerFactory()23     internal SimpleHandlerFactory() {
24     }
25 
GetHandler(HttpContext context, string requestType, string virtualPath, string path)26     public virtual IHttpHandler GetHandler(HttpContext context, string requestType,
27         string virtualPath, string path) {
28 
29         // This should never get called
30         //Debug.Assert(false);
31 
32         return ((IHttpHandlerFactory2)this).GetHandler(context, requestType,
33             VirtualPath.CreateNonRelative(virtualPath), path);
34     }
35 
IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)36     IHttpHandler IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType,
37         VirtualPath virtualPath, String physicalPath) {
38 
39         BuildResultCompiledType result = (BuildResultCompiledType)BuildManager.GetVPathBuildResult(
40             context, virtualPath);
41 
42         // Make sure the type has the correct base class (ASURT 123677)
43         Util.CheckAssignableType(typeof(IHttpHandler), result.ResultType);
44 
45         return (IHttpHandler) result.CreateInstance();
46     }
47 
ReleaseHandler(IHttpHandler handler)48     public virtual void ReleaseHandler(IHttpHandler handler) {
49     }
50 }
51 
52 }
53