Request.Params的内容

Request是ASP.NET内置七大对象之一,Request中的Params是一种集合,它包含了常用QueryString、Form、ServerVariable等等内容,有时它能够通过确定Request.Params[int key]来取得相应的值,可是Request中的Params里面到底都是一些什么东西呢?

有一个简单的html页面,包含了两个 input 和一个<a>标签

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
<form action="RequestTest.aspx" method="get">
 <input type="text" name="inputname" id="123" />
 <input type="submit" name="submits " value="提交" id="456" />
 <br />
 <a href="HTMLPage.htm">跳转</a>
</form>
</body>
</html>

我们在输入框中输入 测试 两个字,然后点击名为 提交 的按钮

在承接GET数据的RequestTest.aspx页面后台,我们做如下工作:

        string str="";
        for (int i = 0; i < Request.Params.Count;i++ )
             str+= Request.Params[i]+" ";
        txt.Text = str;
      

我们看看str里面的内容

测试 嫑 提交 嫑 04jrm1nuov1u0rutxle2ta4s 嫑 HTTP_CONNECTION:Keep-AliveHTTP_ACCEPT:image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*HTTP_ACCEPT_ENCODING:gzip, deflateHTTP_ACCEPT_LANGUAGE:zh-CNHTTP_COOKIE:ASP.NET_SessionId=04jrm1nuov1u0rutxle2ta4sHTTP_HOST:localhost:6601HTTP_REFERER:http://localhost:6601/WebSite1/RequestTestPage.htmHTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Zune 4.7; InfoPath.2) 嫑 Connection: Keep-AliveAccept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*Accept-Encoding: gzip, deflateAccept-Language: zh-CNCookie: ASP.NET_SessionId=04jrm1nuov1u0rutxle2ta4sHost: localhost:6601Referer: http://localhost:6601/WebSite1/RequestTestPage.htmUser-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Zune 4.7; InfoPath.2) 嫑  嫑 F:\homework\WebSite1\ 嫑  嫑  嫑  嫑 JhoneLee-PC\Jhone Lee 嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑 0 嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑  嫑 127.0.0.1 嫑 /WebSite1/RequestTest.aspx 嫑 F:\homework\WebSite1\RequestTest.aspx 嫑 inputname=%E6%B5%8B%E8%AF%95&submits+=%E6%8F%90%E4%BA%A4 嫑 127.0.0.1 嫑 127.0.0.1 嫑  嫑 GET 嫑 /WebSite1/RequestTest.aspx 嫑 localhost 嫑 6601 嫑 0 嫑 HTTP/1.1 嫑  嫑 /WebSite1/RequestTest.aspx 嫑 Keep-Alive 嫑 image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */* 嫑 gzip, deflate 嫑 zh-CN 嫑 ASP.NET_SessionId=04jrm1nuov1u0rutxle2ta4s 嫑 localhost:6601 嫑 http://localhost:6601/WebSite1/RequestTestPage.htm 嫑 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Zune 4.7; InfoPath.2) 嫑

里面内容很丰富,全是各种页面的信息以及浏览器、服务端、文件、协议、站点的信息,内容很丰富,有的根本就不知道是什么意思。。。。

这里写出来主要是做一个记录而已。

原文地址:https://www.cnblogs.com/JhoneLee/p/3081363.html