在web.config中配置自定义404页面

时间:2015-04-21 14:06:22

标签: asp.net

我必须使用web.config文件配置404页面。 我设计了一个自定义404页面并将其放在根目录中。

这是我的代码:

    <httpErrors>
           <remove statusCode="404" subStatusCode="-1" />
           <error statusCode="404" path="http://example.net/404Page.php" responseMode="ExecuteURL" /> //here is my code to redirect the user to the 404 page
    </httpErrors>

但它不适合我。

1 个答案:

答案 0 :(得分:0)

试试这个让我知道你得到了什么

<customErrors mode="Off">
     <error statusCode="404" redirect="http://example.net/404Page.php" />
</customErrors>
相关问题