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.
??
"JJ" <abc@xyz.comwrote in message
news:uTTz9nzOHHA.4280@TK2MSFTNGP02.phx.gbl...
Quote:
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
>
"JJ" <abc@xyz.comwrote in message
news:uQQyZOzOHHA.2140@TK2MSFTNGP03.phx.gbl...
Quote:
>>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
>>
>>
>
>