Re: Detecting Failed Authorization
From: Tampa .NET Koder (TampaNETKoder_at_discussions.microsoft.com)
Date: 11/30/04
- Next message: Tampa .NET Koder: "RE: MatrixProjects.mdb - where can I find it?"
- Previous message: Bijoy Naick: "Re: Detecting Failed Authorization"
- In reply to: Bijoy Naick: "Re: Detecting Failed Authorization"
- Next in thread: Ken Dopierala Jr.: "Re: Detecting Failed Authorization"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 30 Nov 2004 13:39:08 -0800
I don't think this can be trapped within the global.asax file then, the
authentication request is handled throught it. However, if your user does get
the IE 403 error page, "Not Authorized to view this page", then you can
replace this error page with your own using the <customErrors element> like
below:
<customErrors mode="RemoteOnly" defaultRedirect="/genericerror.htm">
<error statusCode="500" redirect="/error/callsupport.htm"/>
<error statusCode="404" redirect="/error/notfound.aspx"/>
<error statusCode="403" redirect="/error/noaccess.aspx"/>
</customErrors>
this is all I can think of.
"Bijoy Naick" wrote:
> I think u misunderstood my question. The authentication piece works fine.
>
> Problem occurs when a user authentcates successfully but does not have
> access (authorization) to a folder. In this case, they get booted back to
> teh login page.. How can I detect a failed authorization? so that I can
> display a meaningfull error msg.
>
> Bijoy
>
>
> "Tampa .NET Koder" <TampaNETKoder@discussions.microsoft.com> wrote in
> message news:D370107A-67B4-4543-9B1C-C9EF712E904D@microsoft.com...
> > The forms tag in the web.config file has a loginUrl attribute that you
> can
> > give it an login.aspx page which every user will be redirected to this
> page
> > if they are not authenticated. Once authenticated, they will be
> > automatically be redirected to the page that they were trying to access.
> >
> > "Bijoy Naick" wrote:
> >
> > > I've implemented forms authentication and authorization on my
> application.
> > > In my Web.Config, my authorization section looks like this..
> > >
> > > <authorization>
> > > <allow roles="admin" />
> > > <deny users="*" />
> > > </authorization>
> > >
> > > If an authenticated user, who is NOT designated the role "admin"
> attempts
> > > to access this folder, he/she is simply redirected to the login page.
> > >
> > > How do I detect a failed authorization and display a meaninfull error
> msg? I
> > > found an article which came up with solution :
> > >
> > > Sub Global_EndRequest(ByVal sender As Object, ByVal e As
> System.EventArgs)
> > > Handles MyBase.EndRequest
> > > If User.Identity.IsAuthenticated And Response.StatusCode = "401"
> Then
> > > Response.Redirect("test.aspx")
> > > End If
> > > End Sub
> > >
> > > When I implement this, and the the situation described above occurs, the
> > > application seems to hang.. ie. the user isn't allowed into the
> application
> > > but it never redirects to test.aspx.
> > >
> > > Any suggestions??
> > >
> > > Bijoy
> > >
> > >
> > >
>
>
>
- Next message: Tampa .NET Koder: "RE: MatrixProjects.mdb - where can I find it?"
- Previous message: Bijoy Naick: "Re: Detecting Failed Authorization"
- In reply to: Bijoy Naick: "Re: Detecting Failed Authorization"
- Next in thread: Ken Dopierala Jr.: "Re: Detecting Failed Authorization"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|