类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
由于在很多不同的页创建了session对象,到最后自己也记不清有哪些session。所以,有没有什么办法可以获得所有session信息。这样我就可以清空session,不影响其它的页。
网友回答:
// Clear the contents of their session
HttpContext.Current.Session.Clear();
// Tell the system to drop the session reference so that it does
// not need to be carried around with the user
HttpContext.Current.Session.Abandon();
for(int i = 0;i < Session.Count;i++)
{
ShowMessage(Session[i].ToString());
}
int n=Session.Count;
for(int i=0;i<n;i++)
Response.Write("<script>window.alert("+Session[i].ToString()+")</script>");