Thursday 3 January 2013

Redirect to UnAuthorized Page

Modify your global.asax like below :

VB
 Public Sub Application_AuthorizeRequest(ByVal sender As Object, ByVal e As EventArgs)  
 If (sender.Request.Path.ToUpper().EndsWith("LOGIN.ASPX") And sender.Request.IsAuthenticated) Then  
   sender.Response.Redirect("~/users/Unauthorized.aspx")  
 End If  
 End Sub 

When you already loged-in and want to access unauthorized page, usualy the page redirect to login.aspx again without any message that you rectricted.

No comments:

Post a Comment