Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET 2.0 session cookie lost if global.asax is not present

Reply
Thread Tools

ASP.NET 2.0 session cookie lost if global.asax is not present

 
 
=?Utf-8?B?QnJpYW4gV2FsdGVycw==?=
Guest
Posts: n/a
 
      04-25-2006
I just wanted to post this after looking in google and not finding anything
about it:


If you create an asp.net 2.0 project, you will find that it does not save
the session cookie unless you add a global.asax file to the project (in 2.0
there is not one by default).

More specifically, you must handle the Session_Start event in order for
sessions to be persisted. I checked this by creating a page with two
controls: a text box and a button. The Page_Load for the page has
"TextBox1.Text = Session.SessionID;" in it. You will notice a different
session id is generated each time you click the button. This behavior is not
expected. The SessionID should be the same for each postback.

The behavior stops if you add a Global.asax file to the project.

 
Reply With Quote
 
 
 
 
ddrib ddrib is offline
Junior Member
Join Date: Feb 2008
Posts: 1
 
      02-26-2008
You were right as soon as I created a global.asax in my project bang! Session works straight away. Thanks for the tip.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET_SessionId cookie not present in POST request. sant Software 0 08-05-2011 06:47 PM
OS present but not present. XPD NZ Computing 4 04-11-2007 11:22 PM
Cookie and Session Cookie Questions. Shapper ASP .Net 1 04-27-2005 11:20 AM
Session cookie? Browser instance cookie? Ben ASP .Net 3 06-03-2004 03:41 AM
Schema: express that "@a present if and only if @b present", where @a, @b are attributes Ralf Wahner XML 5 12-24-2003 11:37 AM



Advertisments