if (Session["UserName"] == null || Session["UserName"].ToString() == ""){txtName.Focus();}else{Response.Redirect("../LoginManage/LoginOk.aspx");}
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/18 00:22:09
![if (Session[](/uploads/image/z/6272633-65-3.jpg?t=if+%28Session%5B%22UserName%22%5D+%3D%3D+null+%7C%7C+Session%5B%22UserName%22%5D.ToString%28%29+%3D%3D+%22%22%29%7BtxtName.Focus%28%29%3B%7Delse%7BResponse.Redirect%28%22..%2FLoginManage%2FLoginOk.aspx%22%29%3B%7D)
if (Session["UserName"] == null || Session["UserName"].ToString() == ""){txtName.Focus();}else{Response.Redirect("../LoginManage/LoginOk.aspx");}
if (Session["UserName"] == null || Session["UserName"].ToString() == "")
{
txtName.Focus();
}
else
{
Response.Redirect("../LoginManage/LoginOk.aspx");
}
if (Session["UserName"] == null || Session["UserName"].ToString() == ""){txtName.Focus();}else{Response.Redirect("../LoginManage/LoginOk.aspx");}
if (Session["UserName"] == null || Session["UserName"].ToString() == "")
//session是获取本第存取的对话,这个和cookie比较像,就是在你电脑上存一些东西.现在读取
//了.session相当于数组,username就是其中的一个索引,这句话就是读取session这个数组中索
//引值为username的值 ,如果此电脑不存在就为null,存在如果为空也成立
{
txtName.Focus();//让一个文本框获得焦点,也就是可以直接输入而不用点进去再输
}
else
{
Response.Redirect("../LoginManage/LoginOk.aspx");//如果不成立就跳转到这个地址.
}
综合来讲就是判断你是否登录过,如果登陆了直接跳转到后面的网址,否则需要输入用户名.