类别:技术杂谈 / 日期:2019-06-13 / 浏览:1803 / 评论:0
废话不多,代码如下:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpErrors errorMode="Custom"> <remove statusCode="502" subStatusCode="-1" /> <remove statusCode="501" subStatusCode="-1" /> <remove statusCode="500" subStatusCode="-1" /> <remove statusCode="412" subStatusCode="-1" /> <remove statusCode="406" subStatusCode="-1" /> <remove statusCode="405" subStatusCode="-1" /> <remove statusCode="403" subStatusCode="-1" /> <remove statusCode="401" subStatusCode="-1" /> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="401" prefixLanguageFilePath="" path="/ErrorPages/401.html" responseMode="ExecuteURL" /> <error statusCode="404" prefixLanguageFilePath="" path="/ErrorPages/404.html" responseMode="ExecuteURL" /> <error statusCode="403" prefixLanguageFilePath="" path="/ErrorPages/403.html" responseMode="ExecuteURL" /> <error statusCode="405" prefixLanguageFilePath="" path="/ErrorPages/405.html" responseMode="ExecuteURL" /> <error statusCode="406" prefixLanguageFilePath="" path="/ErrorPages/406.html" responseMode="ExecuteURL" /> <error statusCode="412" prefixLanguageFilePath="" path="/ErrorPages/412.html" responseMode="ExecuteURL" /> <error statusCode="500" prefixLanguageFilePath="" path="/ErrorPages/500.html" responseMode="ExecuteURL" /> <error statusCode="501" prefixLanguageFilePath="" path="/ErrorPages/501.html" responseMode="ExecuteURL" /> <error statusCode="502" prefixLanguageFilePath="" path="/ErrorPages/502.html" responseMode="ExecuteURL" /> <error statusCode="503" prefixLanguageFilePath="" path="/ErrorPages/503.html" responseMode="ExecuteURL" /> </httpErrors> </system.webServer> </configuration>
注意状态码statusCode和路径path不要填错即可,直接保存为web.config即可生效。
版权声明 : 本文使用「署名-非商业性使用-相同方式共享 4.0 国际」创作共享协议,转载或使用请遵守署名协议。
发表评论 / 取消回复