protected void Page_Load(object sender, EventArgs e) { string strSql = ""; DataSet ds = new DataSet(); dbutil DBUtil = new dbutil(); if (Session["user_name"] == null) { strSql = "select cname,dept from tms_empinfo t where t.empno='" + HttpContext.Current.User.Identity.Name.Substring(HttpContext.Current.User.Identity.Name.IndexOf("\\") + 1).ToUpper() + "'"; ds = DBUtil.GetDataset(strSql); if (ds.Tables[0].Rows.Count == 0) { deny_message(); } else { Session["user_name"] = ds.Tables[0].Rows[0]["cname"].ToString(); Session["user_dept"] = ds.Tables[0].Rows[0]["dept"].ToString(); } } }