Solved

Object reference not set to an instance of an object

Posted on 2007-12-03
2
226 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:BobCSD
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:BobCSD
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 5 117
.Net application crashing 6 21
Round a string to two digits 12 24
Achieve json result 2 34
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

21 Experts available now in Live!

Get 1:1 Help Now