Solved

Object reference not set to an instance of an object

Posted on 2007-12-03
2
236 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
[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 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 2

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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 …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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