By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,677 Members | 1,882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,677 IT Pros & Developers. It's quick & easy.

Session Confusion

P: n/a
BackGround:
- We are new to ASP
- We thought we would experiment with using the session object (in proc) to store a small amount of data.
- We get different results when cookieless is set to "true" veses "false".
- Our simple test app involved updating a counter that was stored as an item in the Session Object. We allow resetting the counter to zero, and adding or subtracting one from the counter.
- We were trying to determine when a "NEW Session" is created -- so we kept in our App adding and resetting and subtracting. After each we displayed the values and everything worked fine. When the user entered a URL for a different site (Goggle.com) and then entered the URL for our page -- initially we see that the counter was reset to zero through our logic in the "Page_Load" routine for a new session.
- When using Session option of Cookieless = 'false', when we do an add it picks up the previous Counter Value that was used before we went to the other Web site (Goggle.com). This is confusing because we use the Session Counter field to display the Counter when 1st returning to this page and it displays a value of Zero. We also noticed that the Session ID does not change but "Session.IsNewSession" property is set to True.
- When using Session option of Cookieless = 'true', when we do an add it picks up the new initialized Counter Value (Zero) that was set in "Page_Load" after returning from the Web site (Goggle.com). In this case we see a new SessionID and the "Session.IsNewSession" property is set to True.

If you would like to see this in action where "SessionState" cookieless option ="false" you can use the following link.

http://www.hoffmanngroupservices.com...THomePage.aspx

Thanks
Dinkster

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Please read this to understand what is going on with session and how new
requests affect it.
http://tinyurl.com/2t7gq

--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Dinkster" <an*******@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
BackGround:
- We are new to ASP
- We thought we would experiment with using the session object (in proc) to store a small amount of data. - We get different results when cookieless is set to "true" veses "false". - Our simple test app involved updating a counter that was stored as an item in the Session Object. We allow resetting the counter to zero, and
adding or subtracting one from the counter. - We were trying to determine when a "NEW Session" is created -- so we kept in our App adding and resetting and subtracting. After each we
displayed the values and everything worked fine. When the user entered a
URL for a different site (Goggle.com) and then entered the URL for our
page -- initially we see that the counter was reset to zero through our
logic in the "Page_Load" routine for a new session. - When using Session option of Cookieless = 'false', when we do an add it picks up the previous Counter Value that was used before we went to the
other Web site (Goggle.com). This is confusing because we use the Session
Counter field to display the Counter when 1st returning to this page and it
displays a value of Zero. We also noticed that the Session ID does not
change but "Session.IsNewSession" property is set to True. - When using Session option of Cookieless = 'true', when we do an add it picks up the new initialized Counter Value (Zero) that was set in
"Page_Load" after returning from the Web site (Goggle.com). In this case we
see a new SessionID and the "Session.IsNewSession" property is set to True.
If you would like to see this in action where "SessionState" cookieless option ="false" you can use the following link.
http://www.hoffmanngroupservices.com...THomePage.aspx

Thanks
Dinkster

Nov 18 '05 #2

P: n/a
Dinkster,

You need to probably better understand how browsers treat cookies in order
to better understand ASP.NET sessions (cookieless=false). Primarily there
are two types of cookies. Those that get saved on the hard drive somewhere
and those that are not. The second variety are called session cookies. These
have nothing to do with ASP/ASP.NET sessions but actually to do with a
browser session. Session cookies are valid/available till a browser session
is active. In other words, till as long as the browser instance is not
closed, the session cookie (once set) is available. Once the browser is
closed, the session cookie is gone (that is, the browser session has ended).

ASP.NET creates these kind of cookies (browser session cookies). As a result
you see the behavior you see. That is, even if you go to another website and
come back, the ASP.NET session is still "alive" (provided the session
timeout has not elapsed). This explanation should clear your confusion.

As regards "new" sessions etc. you might want to use the global.asax file
with various events for when sessions start, end etc. Using these events are
probably a better way to hook into starting and ending of sessions.
--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.