Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 563865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:42:18+00:00 2026-05-13T12:42:18+00:00

I recently set up a new instance of my personal website on the same

  • 0

I recently set up a new instance of my personal website on the same server as the actual site. The new instance is a “latest” configuration so it’s got all the new features of the latest build I’m working on. The latest build I’ve switched the Target Framework to 3.5 from 2.0 as the only really major change as fas as the compiled items go.

On all member pages and some other pages and some user controls I call one or both of these two items, and each are failing and causing an Object reference not set to an instance of an object, error. But not on every page!

    public static string CurrentUserName
    {
        get
        {
            string userName = "";
            if (HttpContext.Current.User.Identity.IsAuthenticated)
                userName = HttpContext.Current.User.Identity.Name;
            return userName;
        }
    }

    public static string CurrentUserID
    {
        get
        {
            string userID = "";
            if (HttpContext.Current.User.Identity.IsAuthenticated) //Line 39
            {
                MembershipUser user = Membership.GetUser();
                userID = user.ProviderUserKey.ToString();
            }
            return userID;
        }
    }

With the stack trace being:

[NullReferenceException: Object reference not set to an instance of an object.]
   isClasses.BizObjects.get_CurrentUserID() in C:\My Dropbox\Trunk\Classes\BizObjects.cs:39
   TheImageStore_Profile..ctor() in w:\dev\Member\Profile.aspx.cs:9
   ASP.member_profile_aspx..ctor() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\faba6118\7249af47\App_Web_profile.aspx.48943a5b.w8t4pvz5.0.cs:0
   __ASP.FastObjectFactory_app_web_profile_aspx_48943a5b_w8t4pvz5.Create_ASP_member_profile_aspx() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\faba6118\7249af47\App_Web_profile.aspx.48943a5b.w8t4pvz5.2.cs:0
   System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
   System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +37
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +307
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

But mind you, this is only happening in IIS 7 on Server 2008, the site is working perfectly from Visual Studio 2008. I’ve even attached the main website in IIS to this directory and it does the same thing. How is it possible to have this happen, and what could be the cause?

Just for kicks I changed the Target Framework back to 2.0 and it’s still causing the same issue. Also this seems to be happening with or without the visitor being logged in, and not just on member pages.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:42:19+00:00Added an answer on May 13, 2026 at 12:42 pm

    Either HttpContext.Current.User or user.ProviderUserKey is null.

    I would guess the former. Which line is line 39?

    Also, is there a user logged in?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently set up a new site that runs a database via MAMP. It's
We recently bought a new rack and set of servers for it, we want
I've recently inherited a fairly large web site. The project is set up as
I recently moved a database from a 'SQL Server 2005 SP1' instance to 'SQL
I've recently set up a new system and wanted to install Padre to check
I've recently set up an ASP.net site (not using MVC.net) to use URL Routing
I recently bought and read a box set of books on security ( Building
Let me set the stage here. I'm a very junior developer who's recently made
Recently, I started changing some of our applications to support MS SQL Server as
Recently our site has been deluged with the resurgence of the Asprox botnet SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.