Skip to content

Instantly share code, notes, and snippets.

@bestpika
Last active November 10, 2015 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bestpika/9fb6cf4c393d818cd9c0 to your computer and use it in GitHub Desktop.
Save bestpika/9fb6cf4c393d818cd9c0 to your computer and use it in GitHub Desktop.
Web.config 指定 httpErrors 行為
<configuration>
<system.web>
<customErrors mode="On">
<!-- 先移除 -->
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<!-- 再增加 -->
<error statusCode="401" path="https://google.com" responseMode="Redirect" />
<error statusCode="403" path="/403.html" responseMode="ExecuteURL" />
<error statusCode="404" path="/404.html" responseMode="ExecuteURL" />
</customErrors>
</system.web>
<system.webServer>
<httpErrors>
<!-- 先移除 -->
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<!-- 再增加 -->
<error statusCode="401" path="https://google.com" responseMode="Redirect" />
<error statusCode="403" path="/403.html" responseMode="ExecuteURL" />
<error statusCode="404" path="/404.html" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment