Click here to Skip to main content
15,917,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here i have a query that is

if i created an application i used sessions also when i run that application in browser. it will generate a session id right. if i copy the url and paste it in separate browser will i get the same session id or different session Id?

and
if i get the same session id what is the use? if i get get the different session id what is the disadvantage?

can anyone please help me

Thanks in advance
Posted

1 solution

If you look at the MSDN documentation: ASP.NET Session State Overview[^] it says:
"ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session."
Which means that the Session is shared between a single browser instance but by multiple tabs - which makes sense when you think about it from a user POV:

I open Chrome to your shop page, and browse for items - I open three different products in three different tabs.
I look at ProductA and I'm not sure if it need it.
I decide to buy ProductB, so I click on "Buy" and the item is stored in the Session.
I then look at ProductC and decide to buy that as well - I click on "Buy" and it's it stored in the Session.
I then go back to ProductA and decide that I don't want it - so I click on the "Checkout" button to pay for my goods.

If the Session wasn't shared, then niether ProductB or ProductC would be in the shopping basket (as shown by the Session) when I got there, since I came from the ProductA page.

If I open FireFox instead of Chrome, then I get a new Session, but again, it's shared between the FireFox tabs.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900