我想自定义错误页面 
<customErrors mode="On" defaultRedirect="Error.htm"></customErrors>
这段代码应该放在哪个webconfig里啊?我现在是放在单个项目下的webconfig有作用,能跳转到Error.htm
但是放在windows/microsoft.net/....目录下的config中 没作用。网站有很多工程组成,用iis发布的,到底怎么配置自定义错误页面啊?

解决方案 »

  1.   

            <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
      

  2.   

    看看下面的解释,英文不难。
    注意:网站web.config中的设置回覆盖全局的。Welcome to ASP.NET newsgroup.
    As for the <customErrors> setting, it can be configured at both
    machine.config or application
    web.config level... Are you using asp.net
    1.1 or 2.0?<customErrors mode="On" defaultRedirect="~/GenericErrorPage.aspx">
    <error statusCode="403" redirect="NoAccess.htm" />
    <error statusCode="404" redirect="FileNotFound.htm" />
    </customErrors>For asp.net 1.1, we just need to configure the <customErros> element in
    machine.config file.... and to make sure it take effect, you can run
    "iisreset.exe" to restart IIS......For asp.net 2.0, we use a global web.config (under
    %windir%\microsoft.net\framework\vxxxx\config dir.....) instead of
    machine.config for configuring machine level asp.net setting. So you can
    put the <customErrors> setting in that global web.config file........Also, after you save the change, if you're testing in VS2005's test server
    ,
    you can directly see the changes take effect. If you're hosting the
    application in IIS, I also suggest you restart IIS......In addition, both of the machine level <customErrors> setting mentioned
    above can be override by appliation level web.config.....
      

  3.   

    代码我知道,关键是放在哪个web.config中
      

  4.   

    关键是放在哪个web.config中------------------------------1个 站点就1个 web.config ,你想有几个?
      

  5.   

    放在網站的最外面的Web.config里
    這個節點下面 <system.web>
      

  6.   


    看我2楼的回答里不是有吗net1.1和net2.是不一样的。