Custom Error Pages

J

JJ

I have seen many examples to set custom error pages as follows:
<customErrors mode="RemoteOnly" defaultRedirect="errors/ErrorPage.aspx">
<error statusCode="400" redirect="errors/ErrorPage400.aspx" />
<error statusCode="401" redirect="errors/ErrorPage401.aspx" />
<error statusCode="403" redirect="errors/ErrorPage403.aspx" />
<error statusCode="404" redirect="errors/ErrorPage404.aspx" />
</customErrors>



The question I have is: Can this ever work for 401 errors (access denied)? I
can't get it to work - it always redirects to the login page. I am using
forms authentication.

JJ
 
J

JJ

When I check the statuscode on the login page it is always 200, even when
directed when trying to access an a page byond the users rights.
If I am being really stupid here (again), I'd really appreciate if someone
could point out the obvious to me (politely ofcourse).

Thanks,
JJ
 
J

JJ

Ok This is what I've tried, but with no success:

Adding this to the Global.asax file:

protected void Application_EndRequest(Object sender, EventArgs e)

{

if ((Response.StatusCode == 401) && (Request.IsAuthenticated))

{

Response.ClearContent();

Server.Execute("~/Login.aspx?action=unauthorised");

}

}

Result: a 401 status code is never detected.

??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,064
Latest member
naturesElixirCBDReview

Latest Threads

Top