我正在使用会话将值从发送页面发送到接收页面,它工作正常,但问题是我记得URL,我直接运行接收页面,它显示以前的信息,但它是无效的......?
如果最终用户直接访问接收页面,我需要限制或提供类似的消息
我该如何克服这个问题............
这是我的代码
发送.aspx.cs
protected void gv_rowcommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
GridViewRow grow = (GridViewRow)(((LinkButton)e.CommandSource)).NamingContainer;
Session["c"] = grow.Cells[0].Text;
Session["s"] = grow.Cells[1].Text;
Session["e"] = grow.Cells[2].Text;
Session["t"] = grow.Cells[3].Text;
Session["a"] = grow.Cells[4].Text;
Response.Redirect("confirmation.aspx");
}
}
确认.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
lblgetcourse.Text = Convert.ToString(Session["c"]);
lblgetstartdate.Text = Convert.ToString(Session["s"]);
lblgetenddate.Text = Convert.ToString(Session["e"]);
lblgettimings.Text = Convert.ToString(Session["t"]);
lblgetamount.Text = Convert.ToString(Session["a"]);
}