Codeaddict7423
asked on
redirect loop and intermittent HTTP 404 error in C#
Hello,
I have an application that seeks to authenticate users by their windows login.
The purpose of this filter is to allow certain users access to certain pages and others to an "Access Denied" page.
In my web.config page, I have the following:
<customErrors mode="Off" defaultRedirect="Unauthori zedAccess. aspx" redirectMode="ResponseRedi rect">
<error statusCode="400" redirect="ErrorPage/Unauth orizedAcce ss.aspx"/>
<error statusCode="401" redirect="ErrorPage/Unauth orizedAcce ss.aspx"/>
<error statusCode="403" redirect="ErrorPage/Unauth orizedAcce ss.aspx"/>
<error statusCode="404" redirect="ErrorPage/Unauth orizedAcce ss.aspx"/>
</customErrors>
In my Global.asax page, I have the following:
protected void Application_EndRequest(Obj ect sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
if (context.Response.Status.C ontains("4 01"))
{
context.Response.ClearCont ent();
Response.Redirect("./Error Page/Unaut horizedAcc ess.aspx") ;
}
if (context.Response.Status.C ontains("4 00"))
{
context.Response.ClearCont ent();
Response.Redirect("./Error Page/Unaut horizedAcc ess.aspx") ;
}
}
The issues are:
ANY help would be greatly appreciated.
I have an application that seeks to authenticate users by their windows login.
The purpose of this filter is to allow certain users access to certain pages and others to an "Access Denied" page.
In my web.config page, I have the following:
<customErrors mode="Off" defaultRedirect="Unauthori
<error statusCode="400" redirect="ErrorPage/Unauth
<error statusCode="401" redirect="ErrorPage/Unauth
<error statusCode="403" redirect="ErrorPage/Unauth
<error statusCode="404" redirect="ErrorPage/Unauth
</customErrors>
In my Global.asax page, I have the following:
protected void Application_EndRequest(Obj
{
HttpContext context = HttpContext.Current;
if (context.Response.Status.C
{
context.Response.ClearCont
Response.Redirect("./Error
}
if (context.Response.Status.C
{
context.Response.ClearCont
Response.Redirect("./Error
}
}
The issues are:
Local machine: IE Explorer displays pages as expected, however, when I upload the application to the server, I get intermittent "The page cannot be displayed" error messages
Local machine: Google Chrome displays pages as expected, however, when I upload the application to the server, I a flash message indicating "the page has a redirect loop" followed by a "Bad Request" message
ANY help would be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the above page is not publically accessible, you will wind up in an authentication required loop.
Dan