HttpContext(三)-Request
来源:互联网 发布:域名查询备案号 编辑:程序博客网 时间:2024/05/18 15:04
ASP.NET RequestRequest封装了客户端请求信息,是从客户端得到数据,常用的三种取得数据的方法是:Request.Form、Request.QueryString,Request。其第三种是前两种的一个缩写,可以取代前两种情况。而前两种主要对应的Form提交时的两种不同的提交方法:分别是Post方法和Get方法。
ASP.NET Request对象的属性和方法比较多,常用的几个为:UserAgent 传回客户端浏览器的版本信息,UserHostAddress 传回远方客户端机器的主机IP 地址,UserHostName 传回远方客户端机器的DNS 名称,PhysicalApplicationPath 传回目前请求网页在Server 端的真实路径。
ASP.NET Request对象使用之从浏览器获取数据
利用ASP.NET Request对象方法,可以读取其他页面提交过来的数据。提交的数据有两种形式:一种是通过Form表单提交过来,另一种是通过超级链接后面的参数提交过来,两种方式都可以利用Request对象读取。
﹤%@ Page Language="C#"%﹥
﹤%
string strUserName = Request["Name"];
string strUserLove = Request["Love"];
%﹥
姓名:﹤%=strUserName%﹥
爱好:﹤%=strUserLove%﹥
﹤form action="" method="post"﹥
﹤P﹥姓名:﹤input type="TEXT" size="20" name="Name"﹥﹤/P﹥
﹤P﹥兴趣:﹤input type="TEXT" size="20" name="Love"﹥﹤/P﹥
﹤P﹥﹤input type="submit" value="提 交"﹥﹤/P﹥
﹤/form﹥
ASP.NET Request对象使用之得到客户端的信息
利用Request对象内置的属性,可以得到一些客户端的信息,比如客户端浏览器版本和客户端地址等等
﹤%@ Page Language="C#"%﹥
客户端浏览器:﹤%=Request.UserAgent %﹥
客户端IP地址:﹤%=Request.UserHostAddress %﹥
当前文件服务端物理路径:﹤%=Request.PhysicalApplicationPath %﹥
Request常见的属性有:
属性名
值类型
说明
ApplicationPath
String
获取请求的资源在网站上的根路径
ContentEncoding
Encoding
设置请求对象的编码
Cookies
HttpCookieCollection
客户端发送到服务器的Cookie集合
QueryString
NameValueCollection
当前请求的查询字符串集合
UrlReferrer
Uri
获取用户由哪个url跳转到当前页面
- HttpContext(三)-Request
- HttpContext.Current.Request.ServerVariables
- HttpContext.Current.Request.Url
- HttpContext.Current.Request.Url
- HttpContext.Current.Request.ServerVariables
- HttpContext.Current.Request.UrlReferrer说明
- HttpContext.Current.Request.ServerVariables.AllKeys
- HttpContext.Current.Request对象属性
- HttpContext.Current.Request.ServerVariables.AllKeys
- HttpContext.Current.Request.Url 地址
- HttpContext.Current.Request.ServerVariables.AllKeys
- HttpContext.Current.Request.Url 网页地址讲解
- HttpContext(一)-概要
- HttpContext(二)-Items
- HttpContext(四)-Response
- HttpContext(五)-Server
- httpcontext
- HttpContext
- 局域网内服务器从ip查询网站获取本机外网ip方法
- Google App Engine上的Scala+Lift初试 补充
- WebService大讲堂之Axis2(2):复合类型数据的传递
- 日常记录项:crontab 使用格式說明
- PHP源码加密,以前只知道zend guard,今天才知道,原来还有个 ioncube
- HttpContext(三)-Request
- 更改CPropertypage的标题
- 修改bug的方法 此网页上的错误可能会使它无法正确运行
- 复制构造函数与赋值构造函数
- PHP5.3 里split被取消了~~
- 【性能】如何利用vmstat分析系统性能
- 为什么要把父类的析构函数定义成虚函数?
- Apache整合PHP
- 如果你已经20岁了 你真的输不起了 别再孩子了