我试验了一下,不会发生这样的情况的。
private void Button1_Click(object sender, System.EventArgs e)
{
string s = TextBox1.Text;
if (s!="")
{
Session["s"] = s;
Response.Redirect("WebForm2.aspx");
return ;
}
Response.Redirect("WebForm2.aspx");
}--------------
in form2:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
//Session["EXIST"] = "FORM2";
if(Session["s"] != null)
{
Response.Write("<script language=javascript>alert('ok');</script>");
}

}
不管我TextBox1里面输入值与否,if块都会执行的。