为与所述配置的例子; httpErrors> [英] Example of Configuration for <httpErrors>

查看:185
本文介绍了为与所述配置的例子; httpErrors>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Asp.Net 4 Web应用程序在IIS 7上本地运行。
我需要显示一个自定义页面(404)和500,而不是为IIS默认页面。
在Web.Config中使用这个httpErrors

I have a Web Application in Asp.Net 4 running locally on IIS 7. I need display a Custom Page (404) and an 500 instead for the defaults page for IIS. Using this httpErrors in Web.Config

<system.webServer>
    <httpErrors>

我的网站是

C:\inetpub\wwwroot\mysite\

在我的自定义错误页:

C:\inetpub\wwwroot\mysite\ErrorPages\404.htm
C:\inetpub\wwwroot\mysite\ErrorPages\505.htm

我不明白它是如何工作的。能否请您给我提供code的样本?

I do not understand how it works. COuld you please provide me a sample of code?

感谢

推荐答案

我解决我的这个问题。

<httpErrors errorMode="Custom">
    <remove statusCode="404" subStatusCode='-1' />
    <remove statusCode="500" subStatusCode='-1' />
    <error statusCode="404" path="/404.aspx" prefixLanguageFilePath="" responseMode="ExecuteURL"  />
    <error statusCode="500" path="/500.aspx" prefixLanguageFilePath="" responseMode="ExecuteURL" />
  </httpErrors>

这篇关于为与所述配置的例子; httpErrors&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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