コード例 #1
0
 /// <summary>
 /// 判断是否存在cookies,不存在则跳转到登录窗口
 /// </summary>
 public static void JudgeTeacherCookies()
 {
     if (HttpContext.Current.Request.Cookies[teaCookieNname] == null)//如果没登录,跳出
     {
         HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
     }
     else
     {
         string hs  = HttpContext.Current.Request.Cookies[teaCookieNname]["Hs"].ToString();
         string hid = HttpContext.Current.Request.Cookies[teaCookieNname]["Hid"].ToString();
         if (hs == Common.WordProcess.GetMD5_8bit(hid.ToString()))
         {
             LearnSite.BLL.Room rbll = new BLL.Room();
             if (!rbll.ExistMyClass(Int32.Parse(hid)))
             {
                 //如果没有任教班级,则始终跳转至信息页面
                 HttpContext.Current.Response.Redirect("~/Teacher/infomation.aspx", true);
             }
         }
         else
         {
             ClearTeacherCookies();//非法cookies,清除再跳转
             System.Threading.Thread.Sleep(500);
             HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// 判断是否存在cookies,不存在则跳转到登录窗口
 /// </summary>
 public static void JudgeTeacherCookies()
 {
     if (HttpContext.Current.Request.Cookies[teaCookieNname] == null)//如果没登录,跳出
     {
         HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
     }
     else
     {
         Model.TeaCook tmcook = new Model.TeaCook();
         if (tmcook.Ss == teaCookieNname)
         {
             LearnSite.BLL.Room rbll = new BLL.Room();
             if (!rbll.ExistMyClass(tmcook.Hid))
             {
                 //如果没有任教班级,则始终跳转至信息页面
                 HttpContext.Current.Response.Redirect("~/Teacher/infomation.aspx", true);
             }
         }
         else
         {
             ClearTeacherCookies();//非法cookies,清除再跳转
             System.Threading.Thread.Sleep(500);
             HttpContext.Current.Response.Redirect("~/Teacher/index.aspx", true);
         }
     }
 }