ค่า Default Expired Cookies ใน ASP.Net 1.1 มีค่า 50 ปี!!! ซึ่งอันตรายที่จะถูก crackค่า Default Expired Cookies ใน ASP.Net 2.0 จะมีค่า 30 นาที
<system.web> <authentication mode="Forms"> <forms timeout="50000000"/> </authentication></system.web>
Code ส่วนนี้จะใช้สำหรับเปลี่ยน cookie ใหม่หากมี cookie เดิมอยู่แล้ว โดยไปใส่ไว้ใน Global.asax
void Application_PostAuthenticateRequest(Object sender, EventArgs e){if (User.Identity is FormsIdentity){if (((FormsIdentity)User.Identity).Ticket.Expiration >(DateTime.Now.Add(new TimeSpan(0,40320,0)))){FormsAuthentication.RedirectFromLoginPage(User.Identity.Name, true);}}}
Page rendered at Sunday, May 20, 2012 11:45:53 AM (SE Asia Standard Time, UTC+07:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.