PDA

View Full Version : cookies trong ASP.Net



haji
27-05-2003, 16:34
làm sao set Expires cho cookies ? muon set Expires là 365 ngày thì sao ? mình làm giống trong ASP nhưng ko duoc . hic :(

puppy
29-05-2003, 09:04
Làm như vầy được không

Response.Cookies["yourcookie"].Expires = System.DateTime.Now.AddDays(365);

White_Rose
29-05-2003, 12:21
Response.Cookies["yourcookie"] chỉ đọc thôi mà.
dùng
Response.Cookies.Set(cookie); -> thay đổi nội dung
Response.Cookies.Add(cookie); -> thêm cookie mới
tất nhiên cookie có type là HttpCookie