views:

337

answers:

1

I want to read the sessionid in cookie which is automatically generated by asp.net. such as ASP.NET_SessionId. but when i use javascript: document.cookie = "ASP.NET_SessionId=;" since i want to set the ASP.NET_SessionId to be empty.

but after the javascript executed, i found instead of change the ASP.NET_SessionId to empty, system generate a new cookie with ASP.NET_SessionId equal to empty.

why system not modify the cookie but generate a new one ?

Thanks!

A: 

Don't try to re-use the cookie - write your own cookie. The behaviour you are seeing is that when you destroy the cookie, the ASP.NET process creates it again. If you make it blank, it just re-instates it.

Sohnee