ASP.NET-MVC 2427次浏览 本站
The customErrors attribute is used when the .net code is throwing an exception (404, 403, 500 etc) and 
the httpErrors attribute is used when IIS itself is throwing an exception.
So for example I have a simple mvc web application, I define the following config:
    <customErrors mode="On" defaultRedirect="Error.html">
        <error statusCode="403" redirect="/Error403" />
        <error statusCode="404" redirect="/Error404" />
        <error statusCode="500" redirect="/Error500" />
  <httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
    <remove statusCode="403"/>
    <remove statusCode="404"/>
    <remove statusCode="500"/>
    <error statusCode="403" responseMode="ExecuteURL" path="/Error403" />
    <error statusCode="404" responseMode="ExecuteURL" path="/Error404" />
    <error statusCode="500" responseMode="ExecuteURL" path="/Error500" />

来源: <>


电子邮件地址不会被公开。 必填项已用*标注