mvc的六个内置对象(Six built-in objects of MVC)

内置对象: request    response         session          cookie        application            server                      请求           响应              会话            客户数据   当前网站对象       服务器对象 request request 服务器接收客户端数据 Requert.QueryString get请求 Request.Form post请求 Request.MapPath()将虚拟路经转换成物理路径 Request.Files post 请求的文件(文件上传) SaveAs方法需要物理路径 Request.Files[“file”].SaveAs(filename:Request.MapPath(“~/uploads”+Request.Files[“file”].FileName));

response Response.Write 向客户端输出内容 Response.Write(“你好!”); Response.Redirect 重定向 Response.Redirect(url: “http://www.baidu.com”);

session session 会话 数据保存在服务器中存储少量重要的数据比如账号 session 是一个键值对

cookie 特定值,使用过期方式

application HttpContext.Application[“user”]= “123”;

server 路径不变,内容发生变化 server.ransfer 转发 不能转发外站的 ShowDemo 也可以内站html页面 Server.Transfer(path:”~/Home/ShowDemo”);

————————

Built in object: request     response           session           cookie         application             server                       request             response               conversation             Customer data     Current site object         Server object request request server receives client data request.querystring get request.form post request. Mappath() converts virtual path to physical path request.files post requested file (file upload) The SaveAs method requires a physical path request. Files [“file”]. SaveAs (filename: request. Mappath (“~ / uploads” + request. Files [“file”]. Filename));

response Response.Write 向客户端输出内容 Response.Write(“你好!”); Response.Redirect 重定向 Response.Redirect(url: “http://www.baidu.com”);

Session session session data is saved in the server and a small amount of important data is stored. For example, the account session is a key value pair

Cookie specific value, using expiration method

application HttpContext.Application[“user”]= “123”;

The server path remains unchanged and the content changes. Server.transfer cannot forward the showdemo of the external station or the HTML page server.transfer of the internal station (path: “~ / home / showdemo”);