MVC笔记3

Session 会话数据存储在服务器中 存储少量重要数据 如账号

Session 是一个键值对

Session 的存活时间为20分钟

Session 销毁 Abandon/Clear

cookie具有时效性

//储存值123134一天

Response.Cookies.Add(new HttpCookie(name: "token")
{
Value = "123134",
Expires = DateTime.Now.AddDays(1)
});

//用过期的方式清除cookie值
Response.Cookies.Add(new HttpCookie(name: "token")
{
Expires = DateTime.Now.AddDays(-1)
});

 Application是共有的,可在任意浏览器打开

Server.Transfer转发

Server.MapPath 虚拟路径转现实路径

Server.HtmlEncode

Server.HtmlDecode

Server.UrlEncode

Server.UrlEncode

 

posted @ 2021-11-26 04:09  wdlll  阅读(36)  评论(0)    收藏  举报