티스토리 뷰

💼 정보 ver1.0

ASP.NET 쿠키 개요

James Wetzel 2010. 12. 29. 13:20

쿠키 생성(쿠키 컬렉션)
HttpCookie regionCookies = new HttpCookie("interastRegion");

regionCookies.Values[si_DDL.SelectedValue] = dong_DDL.SelectedValue;
regionCookies.Expires = DateTime.Now.AddYears(1);

Response.Cookies.Add(regionCookies);

쿠키 호출(쿠키 컬렉션)
if (Request.Cookies["interastRegion"] != null)
{
     HttpCookie cookieItems = Request.Cookies["interastRegion"];

        if (cookieItems.HasKeys)
        {
            for (int i = 0; i < cookieItems.Values.Count; i++ )
           {
               regionCookies.Values[cookieItems.Values.AllKeys[i]] = cookieItems.Values[i];
           }
        }
}

참고 사이트(키워드) : http://msdn.microsoft.com/ko-kr/library/ms178194(v=VS.80).aspx (ASP.NET 쿠키 개요)

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함