我已经创建了一个捕获经典asp文件请求的处理程序:
<system.webServer>
<handlers>
<add name="LegacyAspHandler" verb="*" path="*.asp"
type="MyNamespace.LegacyAspHandler, MyAssembly" preCondition="managedHandler"/>
</handlers>
<system.webServer>
永远不会调用处理程序。如果我请求存在的asp文件,IIS服务该页面,如果它不存在,则提供404.所以我认为IIS中的某些东西必须在调用HttpHandlers之前处理经典的asp文件,但我无法弄清楚它是什么。
处理程序代码只是样板:
Imports System.Web
Public Class GameModuleHandler
Implements IHttpHandler
''' <summary>
''' You will need to configure this handler in the Web.config file of your
''' web and register it with IIS before being able to use it. For more information
''' see the following link: http://go.microsoft.com/?linkid=8101007
''' </summary>
#Region "IHttpHandler Members"
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
' Return false in case your Managed Handler cannot be reused for another request.
' Usually this would be false in case you have some state information preserved per request.
Return True
End Get
End Property
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
'we never get here
End Sub
#End Region
End Class