Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Object reference not set to an instance of an object

Posted on 2007-12-03
2
Medium Priority
?
238 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

715 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