Maintain the SessionID for Entire Application in ASP.NET

I am implementing the Ecommerce projects, where I need to static SessionID, is there any way to maintain the SessionID in the Entire Application.Explanation of my question is here session.sessionid in but How can I implement this approach.


Now I understand your point

you have to do something like this on the Global.asax file

protected void Session_Start(Object sender, EventArgs e)
  Session["DummyData"] = "dummy";

Adding any value to the Session object at the very first moment after created, you avoids to get different SessionIDs because the Session object wasn't accessed yet.

EDIT Anyway checking your last comment I don't see that this is something that is affecting your development in some way. Probably you're over thinking on this. If you just need to avoid users to buy more than X products, you don't care about this problem. When the first product is added to the session, the same SessionID will be used in successive requests, until it expires.

Reading the other post you mention, it sounds like either Session was not being used, and so a new Session ID was generated on each request. To fix this, just store something (anything) in the session on the first request to make sure it sticks.

Session["something"] = "anything";

Or, it could be that the user did not allow cookies, which would also cause a new session on each request. So, your users need to allow cookies.

Or you could use cookie-less session.

The other post explains it pretty well, I think.

Need Your Help

Nullable Datetime field not getting rendered in Store (Ext.Net)

datetime store jsonreader

<ext:Store ID="StoreSample" runat="server" RemotePaging="true" RemoteSort="true" AutoLoad="true"

Travis CI build passing but status bar still showing error

java travis-ci

Hi so my current build is passing which you can view here: