![]() |
#2
amyeeq2008-01-22 14:44
|
我要写一个judge.aspx,来判断Session,当它为空时,我在判断Cookie是否存在,我自己写了,可是当我在别人的机器上登录时,显示错误,望高手指教.
//当Session不对的时候,
if(Session["flag"] ==null || Convert.ToBoolean(Session["flag"]) != true)
{
//判断Cookie是否为空
HttpCookie myCookie = Request.Cookies["phone"];
string phoneNumber = Convert.ToString(myCookie.Value);
if(phoneNumber==null || phoneNumber == "")
{
Page.RegisterStartupScript("script","<script>alert('您还没有登录,请登录!');window.location.href='/MessageBook/admin_login.aspx';</script>");
}
else
{
Session["flag"] = true;
}
}