I have the following code executing in Application_AuthenticateRequest, so if the user isn't logged in they'll get redirected to an unauthorized page.
Dim IsUnauthorized As Boolean = False
If url.Contains(AdminPage.DIRECTORY) Then
Try
Dim user As IPrincipal = .User
If Not (user.Identity.IsAuthenticated) Then IsUnauthorized = True
Catch ex As Exception
IsUnauthorized = True
End Try
If IsUnauthorized Then redirect = ErrorPage.DIRECTORY & Mid(ErrorPage.UNAUTHORIZED, 2)
End If
It works fine, when the user accesses the page whilst they are logged and also when they are anonymous.
The problem I'm having is when an anonymous user gets to the unauthorized page, then logs in - the Application_Authenti ...
Go to the complete details ...