Session Cookie Applicition

Application["name"] = name;

Application.Lock();

string name = Application["name"].ToString(); 

Application.UnLock();

 

HttpContext.Current.Session["name"] = value;

string name=Session["name"].ToString();

 

public static void WriteCookie(string strName, string strValue, int expires)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
            if (cookie == null)
            {
                cookie = new HttpCookie(strName);
            }
            cookie.Value = HttpUtility.UrlEncode(strValue);
            cookie.Expires = DateTime.Now.AddMinutes(expires);
            HttpContext.Current.Response.AppendCookie(cookie);
        }

  

posted @ 2019-09-26 11:34  龙7龙  阅读(157)  评论(0编辑  收藏  举报