Request Response Session Cookie Application Server
内置对象 Request Response Session Cookie Application Server
请求 响应 会话 客户端数据 当前网站对象 服务器对象/向客户端输入内容
Response.Write("hello word");
Session储存重要数据 如账号密码,安全,每个用户拥有单独的session
Cookie不安全
Application
存储网站共用最新消息,供所有网页更新。
存储供所有网页使用的数据库数据。
清理cookie的特定值,Session.Abandon();
清理cookie的特定值,使用过期方式
Response.Cookies.Add(new HttpCookie(name: "token")
{
Value = "abc",
Expires = DateTime.Now.AddDays(-1)
});
public ActionResult ServerDemo()
{
//路径不变,内容变化
//Server.transfer 转发
//Server.MapPath
//Server.HtmlEncode
//Server.HtmlDecode
//Server.UrlEncode
//Server.UrlDecode
Server.Transfer(path: "/WebForm1.aspx");
return Content("");
}