Re: Detecting Failed Authorization

From: Bijoy Naick (b_naick_at_yahoo.ca)
Date: 11/30/04


Date: Tue, 30 Nov 2004 16:36:15 -0500

Sorry folks.. The code I posted at the bottom of my original post actually
works. I made the mistake of redirecting users to another protected file..
as a result it got into an infinite loop..

Bijoy

"Bijoy Naick" <b_naick@yahoo.ca> wrote in message
news:uy7wokx1EHA.1400@TK2MSFTNGP11.phx.gbl...
> 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
>
>



Relevant Pages

  • access only for authorizated/authenticated users, problem
    ... If an anonymous user ... unauthenitcated user and clicked on the menu item, instead of redirecting me ... Below are some of my web.config settings: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Remove Authorization from Cake php form.
    ... Can you please tell me how can i remove authorization from a Cakephp ... When I am submitting Cakephp form it is redirecting me to a page which ... security certificate.'. ...
    (comp.lang.php)
  • Re: Redirecting a user back to their last page
    ... I have a question concerning redirecting users who have logged in ... > using our login page. ... That's basically how Form Authentication in ASP.NET works. ...
    (microsoft.public.dotnet.general)