Re: Access Denied -- Redirect
From: Violeta Dabnishka (vdabnishka_at_hotmail.com)
Date: 06/09/04
- Next message: Carl T: "SpyHunter & ieloader.dll"
- Previous message: Eugene Mayevski [SecureBlackbox]: "Re: Generating X.509 certificates programatically (self-signed)"
- In reply to: Keith Patrick: "Re: Access Denied -- Redirect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 9 Jun 2004 11:58:57 +0300
It won't work if the user cannot be identified - ie if she presses "Cancel"
in the auth window. In this case the browser will display the first response
received which in all cases is the built-in ASP.Net error page.
The right approach is to handle the Application_EndRequest event where you
can analyze the status code of the last response and to react as necessary
on 401 (access denied):
Here is some excerpt of the Global.asax file:
protected void Application_EndRequest(Object sender, EventArgs e)
{
HttpApplication httpApp = (HttpApplication)sender;
HttpContext httpContext = httpApp.Context;
if (httpContext.Response.StatusCode == 401) // handle the "access
denied" error
{
HttpResponse resp = httpContext.Response;
resp.ClearContent();
resp.WriteFile("401.aspx");
}
}
"Keith Patrick" <richard_keith_patrick@nospamhotmail.com> wrote in message
news:ef2H9YNTEHA.3752@TK2MSFTNGP12.phx.gbl...
> On your IIS properties for the web site, there is a tab called Custom
> Errors. You can replace the page for the Access Denied error with your
own
> page, and that page can basically be <%
> Response.Redirect(http://
>
> "Ann" <anonymous@discussions.microsoft.com> wrote in message
> news:6F6ED3BC-5B12-4536-B00E-4E24FBA04EA0@microsoft.com...
> > I'm creating a corporate Intranet site and due to the nature of some
> information we want to be able to 'deny access' to certain places for
> certain users.
> > But to achieve this we wish to make it as user friendly as possible...
as
> well as friendly to the user.
> > We want the 'access denied' page replaced by a redirection to the
previous
> page or possibly the main page.
> >
> > How would I go about completing this?
> >
> > I am using a Windows 2000 web server with IIS 5.1 and ASP.net
> >
>
>
- Next message: Carl T: "SpyHunter & ieloader.dll"
- Previous message: Eugene Mayevski [SecureBlackbox]: "Re: Generating X.509 certificates programatically (self-signed)"
- In reply to: Keith Patrick: "Re: Access Denied -- Redirect"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|