Quantcast
Channel: .NET Framework Setup and Servicing forum
Viewing all articles
Browse latest Browse all 3295

Redirecting to Error page

$
0
0

Hi Team,

i want to redirect HTTP errors like 400, 404, etc to a default error page  in .net. 

I tried the below code in webconfig file. and it works for fine if the page typed wrongly like page.asp instead of page.aspx.

But it is not working for 404 error even though i used in webconfig file. for example if the page typed wrongly like page.a. instead of page.aspx. the page goes to 404 error instead of errorpage.aspx. 

can any one help me how to implement the http error code to redirect to custom error page?

please note that i dont want to use IIS. is there any other way to use or else am i doing some thing wrong in the below code? please help

<system.web>

<customErrors mode="On" defaultRedirect="~/Error Page/errorpage.aspx">

<errorstatusCode="404"redirect="~/Error Page/errorpage.aspx"/>

</system.web>


Viewing all articles
Browse latest Browse all 3295


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>