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

  • Home
  • SEARCH
  • 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 4059410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:12:19+00:00 2026-05-20T15:12:19+00:00

I have a custom MembershipProvider that I’m using in an ASP.NET 2.0 application. Inside

  • 0

I have a custom MembershipProvider that I’m using in an ASP.NET 2.0 application. Inside of the class that extends membership provider, I have a function called AttemptLogin() that sets session variables if the user is valid. Inside that function, are a number of session variable assignments similar to the following:

HttpContext.Current.Session["id"] = "12345";

AttemptLogin() is being called by the Application_BeginRequest function in global.asax. This code works fine when I open it in visual studio, and then run it in the built-in development server by clicking “Start Debugging”. However, when I deploy it to our testing server (Windows 2003 Server 64-bit running IIS in 32-bit mode), execution breaks when it reaches the code above, giving me the following message:

[NullReferenceException: Object reference not set to an instance of an object.]
   CustomMembershipProvider.AttemptLogin() in c:\Inetpub\wwwroot\Josh\App_Code\CustomMembershipProvider.cs:1097
   ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in c:\Inetpub\wwwroot\Josh\Global.asax:14
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

How can I access the session state successfully in this situation? Why does it work locally and not on the server?

  • 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-20T15:12:20+00:00Added an answer on May 20, 2026 at 3:12 pm

    Session Variables aren’t available at Application_BeginRequest you should look later in the pipeline by handling the Application_AcquireRequestState in your global.asax, I’m honestly puzzled why you don’t get a null ref on your dev box.

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

Sidebar

Related Questions

I have a ASP.Net 2.0 website that is currently using a custom MembershipProvider and
We have got a custom MembershipProvider in ASP.NET . Now there are 2 possible
I am implementing a custom membership provider by inheriting from MembershipProvider. I have my
I am working on an ASP.Net Mvc 3 application using FormsAuthentication with a custom
I have custom membership and role provider (C#) in my .net 4 (webform based)
I have this question: Does implementing a custom MembershipProvider class needs you to implement
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
I have a few models that need to have custom find conditions placed on
I have custom groupViews that need to change state when they are expanded and

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.