如何获得传统的ASP正在与IIS 7集成管道自定义错误页 [英] How to get Custom Error Pages working for Classic ASP with IIS 7 Integrated Pipeline

查看:118
本文介绍了如何获得传统的ASP正在与IIS 7集成管道自定义错误页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作与传统经典的ASP页面(被转换到ASP.NET上按照需求)和新的ASP.NET页面的网站上。 IIS 7综合管线的用途已经与我们的配置非常有帮助。例如,我们能够得到窗体身份验证与经典的ASP页面的工作自动奇迹般地仅仅通过配置web.config文件的相应部分(即没有变化需要经典的ASP页面,更多信息请参阅的这个)。

I'm working on a website with legacy Classic ASP pages (being converted to ASP.NET on an as needed basis) and new ASP.NET pages. Use of IIS 7 Integrated Pipeline has been very helpful with our configuration. For example, we were able to get forms authentication working auto-magically with the classic ASP pages simply by configuring the appropriate sections of the web.config file (i.e. no changes were required to the Classic ASP pages, for more info see this).

我的一位同事认为,自定义错误页面,在web.config&LT指定;&的customErrors GT;部分,也应该是自动神奇地应用到传统的ASP页面,但对于我们的网站它仅适用于ASP.NET页。我也已经能够找到描述应用自定义错误页为经典的ASP与IIS 7集成管道的能力的任何信息。

A colleague of mine believes that custom error pages, as specified in the web.config <customErrors> section, should also be auto-magically applied to the classic ASP pages, but for our website it only works for the ASP.NET pages. Nor have I been able to find any information describing the capability of applying custom error pages to Classic ASP with the IIS 7 integrated pipeline.

是否有可能每一个web.config应用自定义错误页以经典的ASP页面IIS7下运行与综合管线的网站?如果是这样,怎么样?

Is it possible to apply custom error pages to Classic ASP pages per a web.config for an website running under IIS7 with integrated pipeline? If so, how?

推荐答案

IIS7的自定义错误页在&LT处理配置节不是&LT;的customErrors&GT; &LT;的System.Web&GT; 适用于ASP.NET只:

The IIS7 custom error pages are handled in the <system.webServer> configuration section not the <customErrors> section under <system.web> which applies to ASP.NET only:

<configuration>
    <system.webServer>
        <httpErrors>
            <error 
               statusCode="500" 
               subStatusCode="100" 
               path="/500errors.asp" 
               responseMode="ExecuteURL" />
        </httpErrors>
    </system.webServer>
</configuration>

要小心的是,这些设置与ASP.NET自定义错误发生冲突。如果你正在运行的.NET 3.5及以上可设置<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.htt$p$psponse.tryskipiiscustomerrors%28v=VS.90%29.aspx\"相对=nofollow> Response.TrySkipIisCustomErrors 在ASP.NET错误页code-后面(或者如果使用MVC错误控制器)prevent IIS重写你的ASP.NET错误页(S):

Beware though of these settings conflicting with ASP.NET custom errors. If you're running .NET 3.5 and above you can set Response.TrySkipIisCustomErrors in your ASP.NET error page code-behind (or error controller if using MVC) to prevent IIS overriding your ASP.NET error page(s):

Response.TrySkipIisCustomErrors = true // ASP.NET Forms

本文由Rick施特拉尔解释有点更深入这个问题:

This article by Rick Strahl explains this problem in a bit more depth:

IIS 7的错误页面接管500错误

这篇关于如何获得传统的ASP正在与IIS 7集成管道自定义错误页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆