Let the storm money come!

Cookie 获取,设置的简短代码

代码
        public string GetCookie(string cookie)
        {
            
if (Request.Cookies[cookie] != null)
                
return Request.Cookies[cookie].Value;
            
return string.Empty;
        }

        
public void SetCookie(string cookieName, string cookieValue, int expireDate)
        {
            HttpCookie cookie 
= new HttpCookie(cookieName);
            cookie.Expires 
= DateTime.Now.AddDays(expireDate);
            cookie.Value 
= cookieValue;
            Response.Cookies.Add(cookie);
        }

 

posted @ 2010-04-04 12:31  精密~顽石  阅读(198)  评论(0编辑  收藏  举报
在通往地狱的路上,加班能使你更快到达。