复制代码 代码如下:
Session["id"] = user.id.ToString();
Session["name"] = user.name.ToString();
Session["pwd"] = user.password.ToString();
Session["time"] = user.LoginTime.ToString();
Session["authority"] = user.limits.ToString();
复制代码 代码如下:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["id"] == null || Session["name"] == null || Session["time"] == null || Session["authority"] == null || Session["pwd"] == null)
Response.Redirect("~/Login.aspx", true);
if (!IsPostBack)
{
。。。。。。
}
}
复制代码 代码如下:
public void Clear(object sender, EventArgs e)
{
Session["id"] = null;
Session["name"] = null;
ClearClientPageCache();
Response.Redirect("~/Login.aspx");
}
public void ClearClientPageCache()
{
//清除浏览器缓存
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();
}
复制代码 代码如下:
<a target="_self" <SPAN>runat="server" onserverclick</SPAN> ="Clear" >退出系统</a>
复制代码 代码如下:
<a href="~/Login.aspx" target="_self" onclick=“clear()”>账户信息</a>
<script>
function clear()<BR> {<BR> <%Clear();%><BR> }
</script>
复制代码 代码如下:
public void Clear()
{
Session["id"] = null;
Session["name"] = null;
}
新闻热点
疑难解答
图片精选