Session["user_ID"]=Tbx_ID.Text;
Session["user_power"]=dr["user_power"];
Label5.Text=Session["user_ID"].ToString();
Label6.Text=Session["user_power"].ToString();
if(Session["user_power"].ToString()==Label3.Text)
{
Response.Redirect("manager.aspx");
}
else if(Session["user_power"].ToString()==Label4.Text)
{
Response.Redirect("student.aspx");
}
首先用户分两类,管理员权限代码为0,普通用户为1,权限字段为user_power调试中没有语法问题,但是if 判断语句却不能跳转
我用了label5 和label6两个label显示session 中的内容,可以正确显示
但是为什么不能跳转呢,好像代码也没有什么问题啊注:if中 用Session["user_power"].ToString()==0判断时左边是string类型右边是int型
所以小弟用了label来充当传值中介 呵呵, 很弱的说。。
解决方案 »
- NVelocity里怎么显示出dataset的数据???
- 大虾们帮忙,关于win7安装sql 2005的问题
- 怎么样才能知道我要知道的内容放在哪个DLL文件里,现在是反编译成功了。
- 页间跳转求教
- 数据库中增加新记录,不刷新网页,如何获知?
- select * from 表名
- 如何将一个表中赋值给dropdownlist 的值,客户端选择值后再插入到另外一个表中
- 新人报到,请多关照.
- 关于给 showModalDialog 传值的问题
- 关于在Webconfig中定义301重定向时正则表达式如何写
- 关于控制访问的基类,也就是Session或者cookie
- 哪里有免费visual studio .net 2005下载
把 else 去掉
因为在执行的时候
Label3,Label3可能还没被赋值
因此
if(Session["user_power"].ToString()==Label3.Text)
{
Response.Redirect("manager.aspx");
}
else if(Session["user_power"].ToString()==Label4.Text)
{
Response.Redirect("student.aspx");
}
的比较成了string 和 null的比较,所以不成立建议Label3.Text,Label4.Text直接换成常量"0"或者"1"