我有两个页面PageA.aspx和PageB.aspx,也是一个dashboard.aspx。从仪表板中,我们可以访问PageA和PageB。从这些页面导航回仪表板时,我们使用站点地图节点。
PageA sitemap是'Dashboard> PageA',PageB是'Dashboard> PageB'。我点击仪表盘,导航到dashboard.aspx
条件
在PageA.aspx我有一个单选按钮(x和y)和一个提交按钮。我的情况是,当我选择y单选按钮并单击submit时,我应该重定向到PageB.aspx,并且PageB.aspx中的站点地图节点应重命名为'Dashboard> ConditionX'。但是,如果我直接从dashboard.aspx导航到PageB.aspx,那么站点地图节点应该是'Dashboard> PageB'。
我至今
在PageA.aspx完成提交点击,我检查单选按钮,选择并设置一个会话Session["IsCondition"]=true
,然后用Response.Redirect("~/PageB.aspx")
导航到PageB.aspx。
在PageB.aspx的Page_Load()
我检查会话
if (Session["IsCondition"] != null && Convert.ToBoolean(Session["IsCondition"]))
{
//My code here if condition is satisfied
SiteMap.Provider.CurrentNode.ReadOnly = false;
SiteMap.CurrentNode.Title = "ConditionX";
SiteMap.Provider.CurrentNode.ReadOnly = true;
}
else
{
//My code here if I was directly accessing from Dashboard
SiteMap.Provider.CurrentNode.ReadOnly = false;
SiteMap.CurrentNode.Title = "PageB";
SiteMap.Provider.CurrentNode.ReadOnly = true;
}
而且,在dashboard.aspx Page_Load()
我已经设置Session["IsCondition"]=null
问题
当我使用的提交按钮PageA.aspx重定向到PageB.aspx,那么PageB.aspx中的条件工作是正确的,并且站点地图显示为'Dashboard> ConditionX'。在此页面中,如果我点击站点地图中的Dashboard节点,即使导航到Dashboard,dashboard.aspx页面的Page_Load
也不会被触发。由于会话价值没有得到从仪表板页中清除,点击PageB.aspx将加载网页B与条件这是不是我想要的
问题
为什么不仪表盘被解雇? 我在做什么错? 仪表板页面是否被缓存并显示,Page_load没有被解雇?