这是我的加载会话和保存会话值函数。如何选中保留所选值并使用它“跳过”某个页面?谢谢!
protected override void LoadSessionValues()
{
if (Session["ddlClassification"] != null)
{
ddlClassification.SelectedValue = (String)Session["ddlClassification"];
}
}
protected override void SaveSessionValues()
{
Session["ddlClassification"] = ddlClassification.SelectedValue;
}
答案 0 :(得分:5)
if (Session["ddlClassification"].ToString() == "valueToCheckFor")
{
Response.Redirect("page1.aspx", false);
}
else
{
Response.Redirect("page2.aspx", false);
}
根据以下评论更新
在page1.aspx
中protected void Page_Load(object sender, EventArgs e)
{
if (Session["ddlClassification"].ToString() == "valueToCheckFor" || Session["ddlClassification"] == null)
{
Response.Redirect("someOtherPage.aspx", false);
}
}