日期:2014-05-17  浏览次数:20386 次

asp.net接收cookies以及session丢失问题
响应头信息
Cache-Control private
Connection keep-alive
Content-Length 631
Content-Type text/plain; charset=utf-8
Date Mon, 30 Apr 2012 03:12:33 GMT
Server Microsoft-IIS/6.0
Via 1.0 test.abc.com.324647dhf (squid/3.0.STABLE20)
X-AspNet-Version 4.0.30319
X-Cache MISS from test.abc.com.324647dhf
X-Cache-Lookup MISS from test.abc.com.324647dhf:80
X-Powered-By ASP.NET
请求头信息
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Connection keep-alive
Content-Length 32
Content-Type application/x-www-form-urlencoded; charset=UTF-8
Cookie Hm_lvt_bbfa2502bd863a3307bcff3d0c2d1a43=1333021001370; Hm_lvt_bd78d8b2335659b176c255236801d891=1330388869599; Hm_lvt_198231243c943163942405d7ed43cafa=1331371579334; Hm_lvt_bbfa2502bd863a3307bcff3d0c2d1a43=1331810376786; Hx2V_2132_ulastactivity=837aSal0ep5tfJ32NTk9MKpEjXdZ%2BKLlFvT5sSi9TzE3wvhUiDG0; Hx2V_2132_smile=3D1; rtime=20; ltime=1335755460779; cnzz_eid=31291927-1331438717-; UserID=1; 72501Comment=; 6467Comment=; ASPSESSIONIDSQABBTQD=HADLAPPCNCDFCAPPILMDAOEJ; ASP.NET_SessionId=qqxp3wux12iane3w1j0z2h3g; cnzz_a3433468=4; sin3433468=; ASPSESSIONIDQSACCQQC=LKHBMPPCBNPGPHIKEABNMKLK
Host www.ixinchen.com
Referer http://www.ixinchen.com/bbs/admin
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0
X-Requested-With XMLHttpRequest
上面是ff中给出的信息
context.Request.Cookies["UserID"]
这个是在cs文件中接收cookies用的

登录之后,不知道会在什么时候,session会丢失,这个我就忍了
关键是,session丢失之后,cookies也接收不到了,session未丢失时就能接收到
但从ff里面看cookies明明是发送出去的
web.config中是这样写的
<sessionState mode="StateServer"></sessionState>

------解决方案--------------------
如果是做登录认证欢迎参看》http://blog.csdn.net/rayyu1989/article/details/7522332
------解决方案--------------------
ASP.NET_SessionId 才是session的Key!它变了,Session自然就变了。
------解决方案--------------------
当然,即使它不变,Session也会丢失。

不过ASP.NET_SessionId改变了,Session肯定就是不一样的。