Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request["clear"] == "true")
            {
                Cache.Instance.Remove("juncheng_menus");
            }
            CookiesHelper.RemoveCookie("juncheng_platform_user");

            context.Response.Redirect("../login.html?referUrl=" + context.Request.UrlReferrer == null ? string.Empty : context.Request.UrlReferrer.AbsolutePath);
            context.Response.End();
        }
Esempio n. 2
0
 private bool SetCookie(string name, string pwd)
 {
     //下次自动登录
     if (CheckBox1.Checked == true)
     {
         if (!Convert.ToBoolean(hfIsEnableCookie.Value))
         {
             // Response.Write("<script language='javascript'>alert('提示!您的浏览器不接受cookie,将影响一些功能的正常使用,请将浏览器cookie启用!')</script>");
             msg.InnerHtml = "【友情提示】:您的浏览器不接受cookie,将影响一些功能的正常使用,请将浏览器cookie启用!";
             return(false);
         }
         else
         {
             HttpCookie Cookie = CookiesHelper.GetCookie("UserInfo");
             if (Cookie == null)
             {
                 Cookie = new HttpCookie("UserInfo");
                 Cookie.Values.Add("userName", name);
                 Cookie.Values.Add("usertPwd", pwd);
                 //设置Cookie过期时间
                 Cookie.Expires = DateTime.Now.AddMonths(1);//DateTime.Now.AddDays(365);
                 CookiesHelper.AddCookie(Cookie);
             }
             else if (!Cookie.Values["userName"].Equals(name) || !Cookie.Values["usertPwd"].Equals(pwd))
             {
                 CookiesHelper.SetCookie("UserInfo", "userName", name);
                 CookiesHelper.SetCookie("UserInfo", "usertPwd", pwd);
             }
             return(true);
         }
     }
     else
     {
         CookiesHelper.RemoveCookie("UserInfo");
         HttpCookie Cookie = CookiesHelper.GetCookie("UserInfo");
         int        a      = Request.Cookies.Count;
         return(true);
     }
 }