void Page_PreInit(Object sender, EventArgs e)
{
HttpCookie userInfo;
userInfo = Request.Cookies["userInfo"];
Session["EmpID"] = userInfo["EmpID"];
Session["GroupID"] = userInfo["GroupID"];
Session["DeptID"] = userInfo["DeptID"];
Session["SecID"] = userInfo["SecID"];
if (Session["GroupID"] =="1")
{
this.MasterPageFile = "master/hr_dept.Master";
}
else if (Session["GroupID"] == "2")
{
this.MasterPageFile = "master/hr_dept.Master";
}
else if (Session["GroupID"] == "3")
{
this.MasterPageFile = "master/hod_dept.Master";
}
else if (Session["GroupID"] == "4")
{
this.MasterPageFile = "master/default2_dept.Master";
}
else
{
this.MasterPageFile = "master/site.Master";
}
}
我想检查我的会话值,然后根据它加载母版页,我在不同的页面上使用相同的母版页。
答案 0 :(得分:1)
允许您的班级实施IRequiresSessionState 如:
>>> test = "there's a need to capitalize every word"
>>> test.title()
"There'S A Need To Capitalize Every Word"
这是一个标记接口,这意味着不需要实现任何东西,但允许您访问Session。