Solved

User.Identity.IsAuthenticated problem in global. asax

Posted on 2008-10-15
2
984 Views
Last Modified: 2013-11-07
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

0
Comment
Question by:wilcor14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Expert Comment

by:JBart_17
ID: 22724569
0
 
LVL 11

Accepted Solution

by:
William earned 500 total points
ID: 22724601
try
Public Sub Application_AuthenticateRequest(sender As Object, e As EventArgs) 
    If User IsNot Nothing Then 
        If User.Identity IsNot Nothing Then 
            If User.Identity.IsAuthenticated IsNot Nothing Then 
                If User.IsInRole("UnvalidatedEmail") Then 
                    Response.Redirect("VerifyCode") 
                End If 
            End If 
        End If 
    End If 
End Sub 

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question