Pergunta

I am using both <customErrors> and <httpErrors> in my website. I want to redirect my application to custom error page when bad request, access denied , HTTP Error 404.0 - Not Found requests or .net Error occurs to my website. .Net errors are redirecting fine when I add <cutomErrors> tag into web.config and no other impacts.

 <httpErrors errorMode="Custom" >
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="http://localhost/mySite/error.aspx" responseMode="Redirect" />
 </httpErrors>

When I add the above code its redirecting to error.aspx page on error codes 404, but some weird Authentication timeout is happening from some pages in application, when some postback happens in some pages its logging out the application and going to login page. When I remove this httperrors tag then there is no timeout issues. So can anybody give some guidelines on this?

Foi útil?

Solução

The issue is fixed. I had form authentication signout code in Page_Load of error.aspx page. So in some cases its going to error.aspx and coming back it is clearing the session.

FormsAuthentication.SignOut();
            Session.Abandon();

So after moving the above code into some events in the page it is working fine.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top