« Previous Next »

Thread: session variable Issue

Last post 11-21-2008 11:36 PM by steve schofield. 12 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (13 items)

Sort Posts:

  • 08-11-2007, 4:42 PM

    session variable Issue

    I am using Session variable to store an id, that is being used in all web pages in the site. In some pages the session varaible is null. more annoying part is this is in consistent with the pages that throws this error.

    can some one help me figure out what is going on?

     BTW I am using IIS 6.0 .NET 2.0. I have created a website and app pool for running this web application. I tried making it as virtual directory under the default website still same error.

     

    Thanks

    jijo

  • 08-11-2007, 9:07 PM In reply to

    • mvolo
    • Top 25 Contributor
    • Joined on 09-17-2003, 1:48 PM
    • Philadelphia, PA
    • Posts 584
    • IIS MVPs

    Re: session variable Issue

    jijo,

    Are you saying that certain pages always have the variable as null? Or, does it happen sometimes only, on different pages?

    You may lose your sessions if your application / application pool restart (if you are using the default inproc mode), the session times out (Default: 20 minutes), or if somehow the browser loses its cookies (or your code clears them).

    If you are running on a load-balanced web farm, you may observe lost sessions if you are using inproc mode.

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • 08-11-2007, 9:08 PM In reply to

    Re: session variable Issue

    A few things come to mind.

    1) make sure the application pool isn't recycling. By default .NET uses inproc session. When the app pool recycles, your session variables are lost.

    2) You can turn off the setting that shutdown your application pool after 20 minutes. 

    3) .NET 2.0 has a 'feature' so to speak where you change something in your folder causes an app domain recycle.  Google .NET 2.0 and App Domain Recycles. 

    What do you see in the event log.  i would run the webpages locally and see if the w3wp process recycles or changes Process ID.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 08-12-2007, 4:31 PM In reply to

    Re: session variable Issue

    I am sure it is not the time out value issue. I have seven pages, and navigating from one page to another. User selects a value in page 1 and i need to carry over that value in all pages.  I am reading that value in all pages, and some pages reads correctly some do not. The pages that throw error are inconsistent.

     

    There is not load balancer, IIS is running in local machine. Any help or suggestion will be greatly appreciated.

    thanks,

  • 08-12-2007, 4:31 PM In reply to

    Re: session variable Issue

    I am sure it is not the time out value issue. I have seven pages, and navigating from one page to another. User selects a value in page 1 and i need to carry over that value in all pages.  I am reading that value in all pages, and some pages reads correctly some do not. The pages that throw error are inconsistent.

     

    There is no load balancer, IIS is running in local machine. Any help or suggestion will be greatly appreciated.

    thanks,

  • 08-12-2007, 4:34 PM In reply to

    Re: session variable Issue

    Can you please expand this answer>

    1) make sure the application pool isn't recycling. By default .NET uses inproc session. When the app pool recycles, your session variables are lost.

    I am not sure how to check the app pool recycle issue.

  • 08-12-2007, 4:50 PM In reply to

    Re: session variable Issue

    Here is what I see in the output window

     

    'w3wp.exe' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\insightvisionmanager\bbb8a587\507407ed\App_Web_wpxt15ty.dll', Symbols loaded.

    'w3wp.exe' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\insightvisionmanager\bbb8a587\507407ed\App_Web_lkae9ijf.dll', Symbols loaded.

    The thread '<No Name>' (0xf2c) has exited with code 0 (0x0).

    'w3wp.exe' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\insightvisionmanager\bbb8a587\507407ed\App_Web_xkavx4yo.dll', Symbols loaded.

    A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

    'w3wp.exe' (Managed): Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\insightvisionmanager\bbb8a587\507407ed\App_Web_xkavx4yo.dll', Symbols loaded.

    A first chance exception of type 'System.NullReferenceException' occurred in App_Web_xkavx4yo.dll

     

  • 08-12-2007, 4:50 PM In reply to

    Re: session variable Issue

    Event log

    Event code: 3005

    Event message: An unhandled exception has occurred.

    Event time: 8/12/2007 4:47:58 PM

    Event time (UTC): 8/12/2007 8:47:58 PM

    Event ID: f5515dc31c6e49c889a7f12c8e80f2b6

    Event sequence: 8

    Event occurrence: 1

    Event detail code: 0

     

    Application information:

    Application domain: /LM/W3SVC/1/Root/InsightVisionManager-3-128314252164481835

    Trust level: Full

    Application Virtual Path: /InsightVisionManager

    Application Path: C:\Projects\InsightVision\InsightVisionManager\

    Machine name: VMLOCAL

     

    Process information:

    Process ID: 2988

    Process name: w3wp.exe

    Account name: NT AUTHORITY\NETWORK SERVICE

     

    Exception information:

    Exception type: NullReferenceException

    Exception message: Object reference not set to an instance of an object.

     

    Request information:

    Request URL: http://localhost/InsightVisionManager/Admin/Status.aspx?check=1&showlog=0

    Request path: /InsightVisionManager/Admin/Status.aspx

    User host address: 127.0.0.1

    User: VMLOCAL\Administrator

    Is authenticated: True

    Authentication Type: Negotiate

    Thread account name: NT AUTHORITY\NETWORK SERVICE

     

    Thread information:

    Thread ID: 5

    Thread account name: NT AUTHORITY\NETWORK SERVICE

    Is impersonating: False

    Stack trace: at Admin_Status.Page_Load(Object sender, EventArgs e) in c:\Projects\InsightVision\InsightVisionManager\Admin\Status.aspx.cs:line 21

    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)

    at System.Web.UI.Control.OnLoad(EventArgs e)

    at System.Web.UI.Control.LoadRecursive()

    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

     

    Custom event details:

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

  • 08-12-2007, 8:51 PM In reply to

    • mvolo
    • Top 25 Contributor
    • Joined on 09-17-2003, 1:48 PM
    • Philadelphia, PA
    • Posts 584
    • IIS MVPs

    Re: session variable Issue

    You are getting an exception in Admin_Status.Page_Load(Object sender, EventArgs e) in c:\Projects\InsightVision\InsightVisionManager\Admin\Status.aspx.cs:line 21.

    Is this exception you attempting to access HttpContext.Session?

    If so, this is not a recycling issue.  The recycling issues cause session variables to get lost, but the Session itself is available.  If your Session object is null, its a whole other category of issues.

    So, which one is it: NullRef accessing .Session or NullRef accessing a specific session variable?

    Thanks,

    Mike Volodarsky

    Program Manager
    IIS Core Server
    Visit mvolo.com for more inside information on IIS7, IIS and ASP.NET

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • 08-14-2007, 8:16 PM In reply to

    Re: session variable Issue

    I am able to get session.sessionid in all pages without any error. but cannot access Session["site"], which is set in welcome page.

     

    Thanks,

  • 08-15-2007, 8:21 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 10:27 AM
    • Central NJ
    • Posts 6,186
    • IIS MVPs

    Re: session variable Issue

    Can you show some code?  Have you followed up in http://forums.asp.net/ as well?  This is really more of an ASP.NET issue ...

  • 11-19-2008, 8:44 PM In reply to

    • tezr
    • Not Ranked
    • Joined on 11-20-2008, 1:35 AM
    • Posts 1

    Re: session variable Issue

    Steve,

     

    just wanted to pass on thanks for your post that solved my problem. I have a screen that allows our users to manage files in their "current" pool.  Everything was ok until we provided a "Remove" option that actually deleted some sub-folders. Whenever this option was used, all our session variables were lost and they had to log in from scratch.  All I could see was the thread exiting with code 0. Looks like the 'feature' in point 3) was kicking in and clobbering us.

    Thanks again,
    Terry 

     

  • 11-21-2008, 11:36 PM In reply to

    Re: session variable Issue

    Wow! cool glad I was able to provide some direction. 

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
Page 1 of 1 (13 items)
Microsoft Communities