[英]asp.net c# 404 page not found
Can any one help me with the following error. 任何人都可以帮助我解决以下错误。
When I try to type my link like this localhost:1297/Index.aspx
, it open properly. 当我尝试像
localhost:1297/Index.aspx
这样键入链接时,它会正确打开。
But when I try to open the link like this 但是当我尝试打开这样的链接时
http://localhost:1297/Index.aspxabc
it throws 404 error
. 它抛出
404 error
。
I tried to handle this error by add a code in web.config as shown below : 我试图通过在web.config中添加代码来处理此错误,如下所示:
<customErrors mode="On" defaultRedirect="~/Error.aspx">
<error statusCode="404" redirect="~/404.aspx"/>
</customErrors>
But still it is showing the same error : 但是仍然显示相同的错误:
Please following the link which shows the error 请点击显示错误的链接
Try this i think it will solve the issue 试试这个,我认为它将解决问题
<configuration>
<system.web>
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="404.aspx" />
</customErrors>
</system.web>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404"/>
<error statusCode="404" path="/404.aspx" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
</configuration>
您可以使用IIS设置自定义错误页面,请参见https://www.bruceclay.com/blog/microsoft-iis-custom-404-error-page-configuration/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.