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

发布于 2024-08-07 16:37:48 字数 1191 浏览 9 评论 0原文

我正在尝试映射对经典 asp 页面的请求以由 .net 处理,以便它通过自定义 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 请求而不是阻止?

I'm trying to map requests for classic asp pages to be handled by .net, so that it runs through a custom httpmodule.

In IIS I have remapped asp requests to aspnet_isapi.dll - I'm sure I've done this bit right

Now in my test app I am getting this error:

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

Searching online for this error shows a load of people having problems with cassini, but this is not really relevant, I am testing this on both IIS 5.1 on XP dev machine, and have tested on IIS6 also getting the same error.

I have followed instructions for adding and registering a httphandler (see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q308001), but I don't know what to put in the ProcessRequest routine to ensure the request gets passed on. What is the default .net httphandler, can I just map to this in web.config?: so something like:

<httpHandlers>
     <add verb="*" path="*.asp" type="standard.nethttphandler"/>
</httpHandlers>

How do I tell asp.net that it needs to pass ASP requests on and not block?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

活泼老夫 2024-08-14 16:37:48

其实你离成功只有一步之遥。将以下部分添加到本地网站(或虚拟目录)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>

Actually you are only one step far from the success. Adding following section to your Local website(or virtual directory) web.config file:

<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>

ぺ禁宫浮华殁 2024-08-14 16:37:48

看起来 .asp 扩展名已映射到 HttpForbiddenHandler

如果您使用的是 ASP.NET 1.1,请打开以下文件:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config

如果您使用的是 ASP.NET 2.0,请打开此文件:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config

搜索“path="*.asp"”,然后注释掉线。它会像这样:

<!-- machine.config/ASP.NET 1.1-->
<add path="*.asp" verb="*" 
     type="System.Web.HttpForbiddenHandler"/>`

<!-- web.config/ASP.NET 2.0-->
<add path="*.asp" verb="*" 
     type="System.Web.HttpForbiddenHandler" validate="true"/>`

It looks like the .asp extension is mapped to the HttpForbiddenHandler.

If you're using ASP.NET 1.1 then open the following file:

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config

If you're using ASP.NET 2.0 then open this file:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config

Search for "path="*.asp"", then comment out that line. It'll like something like:

<!-- machine.config/ASP.NET 1.1-->
<add path="*.asp" verb="*" 
     type="System.Web.HttpForbiddenHandler"/>`

<!-- web.config/ASP.NET 2.0-->
<add path="*.asp" verb="*" 
     type="System.Web.HttpForbiddenHandler" validate="true"/>`
遇到 2024-08-14 16:37:48

找到以下文件:

C:\WINDOWS\MICROSOFT.NET\FRAMEWORK\\Config\web.config

其中 是文件夹名称:

open在 XML 编辑器中..(甚至记事本也可以)

并添加以下行:

<add path="*.asp" verb="*" type="System.Web.UI.PageHandlerFactory" validate="True"/>

在下面的 XPath:

configuration/system.web/httpHandlers

下替换现有的!

添加以下行:

<add extension=".asp" type="System.Web.Compilation.PageBuildProvider"/>

在下面的 XPath 下:

/configuration/system.web/compilation/buildProviders

对我来说就像 gem 一样:)

Locate the below file:

C:\WINDOWS\MICROSOFT.NET\FRAMEWORK\<FramworkVersion>\Config\web.config

where <FramworkVersion> is folder name:

open it in an XML editor .. (even notepad is fine)

and add below line :

<add path="*.asp" verb="*" type="System.Web.UI.PageHandlerFactory" validate="True"/>

under below XPath:

configuration/system.web/httpHandlers

replace the existing one!

Add below line:

<add extension=".asp" type="System.Web.Compilation.PageBuildProvider"/>

under below XPath:

/configuration/system.web/compilation/buildProviders

Worked like gem for me :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文