Solved

Object reference not set to an instance of an object

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

Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

Question has a verified solution.

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

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 document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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