急!求救!神奇的Session.IsNewSession !急!急!急!
这是登陆页面确认按钮的Click事件
protected void Button1_Click(object sender, EventArgs e)
{
string userName = TextBox2.Text, userPwd = TextBox3.Text;
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(userPwd))
{
Student s = new Student();
s.StuNo = userName;
s.StuPwd = userPwd;
s = s.GetModel(userName);
Session["stuNo"] = s.StuName;
bool b = s.Login();
if (b)
{
if (s.Role)
{
Response.Redirect("adminSpace.aspx?un=" + s.StuName);
}
else
{
Response.Redirect("Default.aspx");
}
}
}
}
同样把上面都注释掉 写上另外一段代码
Response.Redirect("Default.aspx");
前者跳转后Session.IsNewSession值变成了false
后者跳转后Session.IsNewSession值依然是true
求大神帮小弟解决一下啊 刚学asp.net没几天
Session.IsNewSession的值为什么会变啊%>_<%
/更新帖子 12:47
经过一番调查...
我发现Session["stuNo"] = s.StuName;让Session.IsNewSession的值变成false了 有大神能帮忙解释一下是为什么...
这个只有跳转到第二个页面才会监视到Session.IsNewSession变成了false是为什么咩...