Asp.net Study(14)
Application,Session,Cookie
Application:设置全局变量,所设变量在整个应用程序范围内有效。有 Application.Lock() and Application.UnLock() 两个方法。
Session:在Asp中session要依赖于cookie才可运行,但在Asp.net中设置web.config sessionState cookieless="true"则可使session不依赖于cookie
Cookie:实例化一个cookie HttpCookie xxx=new HttpCookie("xxx")设置单值的cookie,cookie.Value="xxx"设置多值的cookie,cookie.Value.Add("KeyWord","value")应用cookie Response.AppendCookie("cookiename")读取cookie HttpCookie xxx=Request.Cookies("xxx")设置cookie的过期时间DateTime xxx=DateTime.Now;TimeSpan xx=new TimeSpan(x,x,x,x) 分别为天,小时,分钟,秒cookie.Expires=xxx.Add(xx)
阅读全文——共2122字