c#에서 cookies

838 단어 Cookies
/////////////////////////////  /////////////////////////////// 



//   cookie   



HttpCookie cookie = Request.Cookies["demo"]; 

//  Cookie       

if (null == cookie) { 

Response.Write("Cookie not found. <br><hr>"); 

} 

else { 

//  Cookie   

String strCookieValue = cookie.Value.ToString(); 

Response.Write("The " + strCookieName + " cookie contains: <b>" 

+ strCookieValue + "</b><br><hr>"); 

} 



/////////////////////////////  /////////////////////////////// 



//     Cookie 

HttpCookie cookie = new HttpCookie("demo"); 

//  Cookie   

cookie.Value = "value"; 

//  cookie   1 ,   7  

cookie.Expires = DateTime.Now.AddDays(7); 

//  Cookie 

Response.Cookies.Add(cookie); 

좋은 웹페이지 즐겨찾기