Add below code to web.config:
<customErrors defaultRedirect="~/PageError.aspx"
mode="On">
<error statusCode="500"
redirect="~/PageError.aspx"/>
<error statusCode="404"
redirect="~/PageNotFound.aspx"/>
</customErrors>
If you found HTTP 404.0-File not Found
then add you have to add more code given below:
<system.webServer>
<httpErrors errorMode="Custom" >
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" path="~/PageNotFound.aspx" responseMode="Redirect" />
</httpErrors>
</system.webServer>
<customErrors defaultRedirect="~/PageError.aspx"
mode="On">
<error statusCode="500"
redirect="~/PageError.aspx"/>
<error statusCode="404"
redirect="~/PageNotFound.aspx"/>
</customErrors>
If you found HTTP 404.0-File not Found
then add you have to add more code given below:
<system.webServer>
<httpErrors errorMode="Custom" >
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" path="~/PageNotFound.aspx" responseMode="Redirect" />
</httpErrors>
</system.webServer>
Very nice information.
ReplyDelete