如何从服务器错误中删除版本信息 "the resource cannot be found"
how to remove version information from server error "the resource cannot be found"
浏览页面时,出现错误:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.
Requested URL: /WebResource.axd
Version Information: Microsoft .NET Framework Version:4.0;
ASP.NET Version:4.0.33
错误符合预期,我需要的是 hide/remove 版本信息 的方法!?如果有...
创建一个您希望用户看到的自定义页面,然后在 web.config
文件中添加类似
的内容
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="404.aspx" redirectMode="ResponseRedirect">
<error statusCode="404" redirect="404.aspx" />
...
</customErrors>
</system.web>
有 3 种不同的模式 On
、Off
、RemoteOnly
On - 指定启用自定义错误。如果未指定 defaultRedirect 属性,用户会看到一般错误。自定义错误显示给远程客户端和本地主机。
Off - 指定禁用自定义错误。向远程客户端和本地主机显示详细的 ASP.NET 错误。
RemoteOnly - 指定自定义错误仅显示给远程客户端,ASP.NET 错误显示给本地主机。这是默认值。
默认是RemoteOnly
想知道customErrors
和httpErrors
here. Also you might want to look at this answer进一步阅读here. Also you might want to look at this answer =19=]
浏览页面时,出现错误:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /WebResource.axd
Version Information: Microsoft .NET Framework Version:4.0; ASP.NET Version:4.0.33
错误符合预期,我需要的是 hide/remove 版本信息 的方法!?如果有...
创建一个您希望用户看到的自定义页面,然后在 web.config
文件中添加类似
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="404.aspx" redirectMode="ResponseRedirect">
<error statusCode="404" redirect="404.aspx" />
...
</customErrors>
</system.web>
有 3 种不同的模式 On
、Off
、RemoteOnly
On - 指定启用自定义错误。如果未指定 defaultRedirect 属性,用户会看到一般错误。自定义错误显示给远程客户端和本地主机。
Off - 指定禁用自定义错误。向远程客户端和本地主机显示详细的 ASP.NET 错误。
RemoteOnly - 指定自定义错误仅显示给远程客户端,ASP.NET 错误显示给本地主机。这是默认值。
默认是RemoteOnly
想知道customErrors
和httpErrors
here. Also you might want to look at this answer进一步阅读here. Also you might want to look at this answer =19=]