I've implemented forms authentication and authorization on my application.
In my Web.Config, my authorization section looks like this..
<authorizatio n>
<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_EndReque st(ByVal sender As Object, ByVal e As System.EventArg s)
Handles MyBase.EndReque st
If User.Identity.I sAuthenticated And Response.Status Code = "401" Then
Response.Redire ct("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
In my Web.Config, my authorization section looks like this..
<authorizatio n>
<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_EndReque st(ByVal sender As Object, ByVal e As System.EventArg s)
Handles MyBase.EndReque st
If User.Identity.I sAuthenticated And Response.Status Code = "401" Then
Response.Redire ct("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
Comment