Ejemplo n.º 1
0
 /// <summary>
 /// 如果没登录,跳转到登录首页
 /// 如果登录,但权限为假,也跳转到教师首页
 /// </summary>
 public static void JudgeIsAdmin()
 {
     if (HttpContext.Current.Request.Cookies[mngCookieNname] == null)//没登录跳出
     {
         HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
     }
     else
     {
         string hs  = HttpContext.Current.Request.Cookies[mngCookieNname]["Hs"].ToString();
         string hid = HttpContext.Current.Request.Cookies[mngCookieNname]["Hid"].ToString();
         if (hs != Common.WordProcess.GetMD5(hid.ToString()))
         {
             ClearManagerCookies();//非法cookies,清除再跳转
             Others.ClearClientPageCache();
             System.Threading.Thread.Sleep(500);
             HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 如果没登录,跳转到登录首页
 /// 如果登录,但权限为假,也跳转到教师首页
 /// </summary>
 public static void JudgeIsAdmin()
 {
     if (HttpContext.Current.Request.Cookies[mngCookieNname] == null)//没登录跳出
     {
         HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
     }
     else
     {
         Model.MngCook mncook = new Model.MngCook();
         if (HttpContext.Current.Session.SessionID == mncook.SessionId && mncook.Hpermiss)
         {
             //正确
         }
         else
         {
             ClearManagerCookies();//非法cookies,清除再跳转
             Others.ClearClientPageCache();
             System.Threading.Thread.Sleep(500);
             HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
         }
     }
 }