asp.net - 在 IIS 中将经典的 asp 页面映射到 .net

标签 asp.net iis asp-classic wildcard-mapping

我正在尝试映射由 .net 处理的经典 asp 页面的请求,以便它通过自定义 httpmodule 运行。

在 IIS 中,我已将 asp 请求重新映射到 aspnet_isapi.dll - 我确定我做对了

现在在我的测试应用程序中,我收到此错误:

Server Error in '/TestASPRedirect' Application.
--------------------------------------------------------------------------------

This type of page is not served. 
Description: The type of page you have requested is not served because it has been explicitly forbidden.  The extension '.asp' may be incorrect.   Please review the URL below and make sure that it is spelled correctly. 

Requested URL: /testaspredirect/test.asp

在线搜索此错误显示有很多人在使用 cassini 时遇到问题,但这并不是真正相关的,我正在 XP 开发机器上的 IIS 5.1 上对此进行测试,并且在 IIS6 上进行了测试,也遇到了相同的错误。

我已按照说明添加和注册 httphandler(请参阅 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q308001 ),但我不知道在 ProcessRequest 例程中放置什么以确保请求得到传递。什么是默认的 .net httphandler,我可以在 web.config 中映射到它吗?:所以像:
<httpHandlers>
     <add verb="*" path="*.asp" type="standard.nethttphandler"/>
</httpHandlers>

我如何告诉 asp.net 它需要传递 ASP 请求而不是阻止?

最佳答案

其实你离成功只有一步之遥。将以下部分添加到您的本地网站(或虚拟目录)web.config 文件中:

<configuration>
...
<system.web>
    <compilation>
        <buildProviders>
            <add extension=".asp" type="System.Web.Compilation.PageBuildProvider"/>
        </buildProviders>
    </compilation>
    <httpHandlers>
        <add path="*.asp" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true"/>
    </httpHandlers>
</system.web>

关于asp.net - 在 IIS 中将经典的 asp 页面映射到 .net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1572746/

相关文章:

asp.net - 当用户未在asp.net中进行身份验证时,如何在登录页面中显示图像?

asp.net-mvc - 使用 AngularJS SPA 的服务器端路由

javascript - 如何使用 Javascript 检查事件目录以查看用户是否属于特定组的成员?

javascript - Asp response.redirect 不重定向

vb.net - 无需注册DLL即可调用VB.Net DLL中的函数

asp.net - 在 ASP.NET 中,什么时候应该使用 Session.Clear() 而不是 Session.Abandon()?

c# - 验证字符串是否存在于列表中

c# - .Net Core 服务架构、 Entity Framework 和职责

asp.net - 在 Amazon Web Service 中托管 ASP.NET 应用程序

Apache Jakarta (Tomcat) 连接器将流量转发到特定的 Tomcat