Link to home
Start Free TrialLog in
Avatar of wilcor14
wilcor14Flag for United States of America

asked on

User.Identity.IsAuthenticated problem in global. asax

In the code snippet below, I am trying to see if the user is logged in and has verified their email using the role manager of .net. As the application loads, the User.Identity.IsAuthenticated produces a
Object reference not set to an instance of an object error

Can anyone help me find a work around. Thanks.
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
       If User.Identity.IsAuthenticated <> Nothing Then
            If User.IsInRole("UnvalidatedEmail") Then
                Response.Redirect("VerifyCode")
            End If
        End If
end sub

Open in new window

Avatar of JBart_17
JBart_17
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of William Domenz
William Domenz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial