我的页面跳转是通过Response.Redirect实现的,那发现Session保存值有问题?A页面(C#)protected void Page_Load(object sender, EventArgs e)
{
//第一次加载网页时
if (!IsPostBack)
{
//执行第一次查询
TextBox1.Text = GetPageIndex();
}
} //取出Session["a_pageindex"]的值
public string GetPageIndex()
{
try
{
return Session["a_pageindex"].ToString();
}
catch (Exception ex)
{
Session["a_pageindex"].ToString() = "1";
return "1";
}
}protected void Button1_Click(object sender, EventArgs e)
{
Session["a_pageindex"] = "2";
}
当页加载时TextBox1的值是"1",当按下Button1后,Session["a_pageindex"] 的值应该为"2"了,当用Response.Redirect转到其它页面后,再回到A页面,这时TextBox1的值还时"1",为什么,应该是"2"才对呀
{
//第一次加载网页时
if (!IsPostBack)
{
//执行第一次查询
TextBox1.Text = GetPageIndex();
}
} //取出Session["a_pageindex"]的值
public string GetPageIndex()
{
try
{
return Session["a_pageindex"].ToString();
}
catch (Exception ex)
{
Session["a_pageindex"].ToString() = "1";
return "1";
}
}protected void Button1_Click(object sender, EventArgs e)
{
Session["a_pageindex"] = "2";
}
当页加载时TextBox1的值是"1",当按下Button1后,Session["a_pageindex"] 的值应该为"2"了,当用Response.Redirect转到其它页面后,再回到A页面,这时TextBox1的值还时"1",为什么,应该是"2"才对呀
TextBox1.Text = GetPageIndex();
//第一次加载网页时
if (!IsPostBack)
{
//执行第一次查询
TextBox1.Text = GetPageIndex();
}
}
所以Session又被赋值成1了。
Session["a_pageindex"] = "1";我本地测试下来 回传后是2
恭喜,微软的大bug被你找到了。- -!
是用连接和是用的go(-1)??????