-1

If in an ASP.NET application the timeout happened and user is logged out. Will entering the Web App URL or opening a Page in the application makes a new session or renews the old session?(Browser shows same session ID, that makes me a bit more confused) whats the difference? Similarly, when a user closes the browser and reopens it after a timeout, will it be a new session or a renewal of old one?

This is quite a novice question but helps in my understanding of Sessions. pls clarify.

Programmerzzz
  • 1,237
  • 21
  • 48

2 Answers2

0

You can have better understanding here. You can refer Sessions Identifier paragraph for it.

As well as this link is also useful for complete understanding.

Tirthak Shah
  • 515
  • 2
  • 11
0

Session.Clear or Session.Abandon is used to destroys a user session(Click). Session ID is maintained within ASP.NET session ID cookie. So you have to remove cookie from the response itself.

HttpCookie myCookie = new HttpCookie("YourSessionId");
myCookie.Expires = DateTime.Now.AddDays(-1d);
Response.Cookies.Add(myCookie);

For better understanding visit here

Hope it will help you.

Community
  • 1
  • 1
Litisqe Kumar
  • 2,512
  • 4
  • 26
  • 40
  • So if I add the above code to remove the sessionid cookie from response while ending user session , every time user logs out programmatically from my site and relogs it will be a new session right? Will the same happen with unbuilt session timeout in asp.net and whenever user closes and reopens the browser? – Programmerzzz Jul 21 '15 at 06:33
  • Give it a try definitely it will help you. – Litisqe Kumar Jul 21 '15 at 06:36