Solved

Object reference not set to an instance of an object

Posted on 2007-12-03
2
229 Views
Last Modified: 2013-11-07
in asp.net, getting error:

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

on this line:
myUser = membertemp.GetUser(Page.User.Identity.Name, True)

here is the code:
        Dim membertemp As CustomMembershipProvider = Nothing

        isLoggedIn = Page.User.Identity.IsAuthenticated
        If isLoggedIn Then
            myUser = membertemp.GetUser(Page.User.Identity.Name, True)

During trace it says something about possibly needing a "New", but I don't know where to put it.???

thanks.

Open in new window

0
Comment
Question by:Starr Duskk
2 Comments
 
LVL 8

Accepted Solution

by:
Chumad earned 500 total points
ID: 20398316
You need to change it to this:

Dim membertemp As New CustomMembershipProvider()

        isLoggedIn = Page.User.Identity.IsAuthenticated
        If isLoggedIn Then
            myUser = membertemp.GetUser(Page.User.Identity.Name, True)
0
 
LVL 1

Author Comment

by:Starr Duskk
ID: 20400091
thanks! Your suggestion solved that area.

But what actually worked was not declaring the membertemp.GetUser at all... but instead calling the original:

myUser = Membership.GetUser(UserID, False)

The above takes me directly to my custom provider and actually retrieves the values. go figure.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now