Reputation: 77
I am working on a asp.net web project in which if I use
in web config
then the encrypted sessionId is visible in URL but if I change cookieless to false then encrypted sessionID get removed from url but I receive a new session.sessionId on each request
Please help so that no encrypted session.sessionID is visible in url and also there should be SINGLE session.sessionId on every request.
Upvotes: 0
Views: 340
Reputation: 24125
If you are using cookies based session management ASP.NET is using some optimalization which results in creating new session every time until there are some actual session data to store. To avoid this you can put a dummy value into session in Session_Start
event available through Global.asax
:
protected void Session_Start(object sender, EventArgs e)
{
Session["DUMMY_KEY"] = "DUMMY_VALUE";
}
This way the session id will remain the same until the session time out occurs.
Upvotes: 1