protected void Page_Load(object sender, EventArgs e) { var userName = Request["UserName"]; var password = Request["Password"]; CookieFactory.CreateCookie("user", userName); CookieFactory.CreateCookie("sid", HttpContext.Current.Session.SessionID); CookieFactory.StoreSession(HttpContext.Current.Session.SessionID, userName); }
protected void Page_Load(object sender, EventArgs e) { var us = HttpContext.Current.Request.Cookies["user"] != null ? HttpContext.Current.Request.Cookies["user"].Value : ""; var sid = HttpContext.Current.Request.Cookies["sid"] != null ? HttpContext.Current.Request.Cookies["sid"].Value : ""; if (CookieFactory.CheckValueIsExist(sid, us) && us != null && sid != null) { Response.Write("us:" + us + "<br/> sid: " + sid + "<br/>has exist."); } else { Response.Write("us:" + us + "<br/> sid: " + sid + "<br/>do not exist."); } }