• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

ASP.NET DEVELOPMENT DEBUGGING MODE - Random crash

Developing on an Asp.Net project in visual studio, i am curious why it crashes very often in a line like this:

myPage.RegisterClientScriptBlock("AJAX_GRID_UPLOAD", "<script src='" + System.Web.HttpContext.Current.Session[SessionConstants.APPLICATION_ROOT].ToString() + "CustomControls/AjaxUpdatePanelGrid.js'></script>");

It has something to do with session expiration. For example, often when i make changes to code in aspx and hit refresh page while in debugging mode, i see my application crashing to that line of code. I would like to avoid it if possible.



Thanks
0
Axiom_Consulting_Developer
Asked:
Axiom_Consulting_Developer
  • 2
1 Solution
 
Paul MacDonaldDirector, Information SystemsCommented:
Check to see if the session exists/persists before you run that line of code.  

It's worth pointing out that sessions expire in production as well as in development.
0
 
Axiom_Consulting_DeveloperAuthor Commented:
The session does expire. But shouldn't as my settings for the sessionstate in application and IIS are set too high. Why would modifying an aspx code and refreshing the browser page cause it to reset the session ?
0
 
Paul MacDonaldDirector, Information SystemsCommented:
Sorry, I thought I'd replied to this.

Yes, changing the codebehind - in debug mode or otherwise - can reset the session, requiring a new session to be instantiated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now