/// <summary>
/// Request.Form,Request.QueryString,Request.Params
/// http://msdn.microsoft.com/en-us/library/system.web.httprequest.params(v=vs.110).aspx
/// Geovin Du 涂聚文
/// 2014-05-28
///Request.Form (for POST) and Request.QueryString (for GET).
///Request.Params是所有post和get传过来的值的集合,request.params其实是一个集合,它依次包括 request.QueryString、request.Form、request.cookies和request.ServerVariable。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button1_Click(object sender, EventArgs e)
{
GeovinduVip.Common.ProcessRequest pr = new GeovinduVip.Common.ProcessRequest(); // Create a string to contain the paramaters'
// information.
string paramInfo = ""; // Obtain a reference to the Request.Params
// collection.
NameValueCollection pColl = Request.Params; // Iterate through the collection and add
// each key to the string variable.
for (int i = 0; i <= pColl.Count - 1; i++)
{
paramInfo += "Key: " + pColl.GetKey(i) + "<br />"; // Create a string array that contains
// the values associated with each key.
string[] pValues = pColl.GetValues(i); // Iterate through the array and add
// each value to the string variable.
for (int j = 0; j <= pValues.Length - 1; j++)
{
paramInfo += "Value:" + pValues[j] + "<br /><br />";
if (!string.IsNullOrEmpty(pValues[j].ToString()))
{
if (ProcessSqlStr(pValues[j].ToString(), 1) == false) //pr.ProcessSqlStr
{
Jscript.Alert("存在非法字符!");
//Response.End();
//return;
}
} }
} // Set a Label's Text property to the values
// contained in the string variable.
//Response.Write(paramInfo); Response.Write("Request.Form.AllKeys:");
//Request.Form.AllKeys; string[] FormColl = Request.Form.AllKeys; for (int j = 0; j <= FormColl.Length - 1; j++)
{
Response.Write(FormColl[j].ToString()+"="+ Request.Form[FormColl[j]] + "<br />");
Response.Write( "<br />");
} Response.Write("Request.Form:"); foreach (string key in Request.Form.Keys)
{
Response.Write(key+"="+Request.Form[key] + "<br />");
}
Response.Write("Request.Form:End <br/>"); Response.Write("Request.QueryString:");
foreach (string key in Request.QueryString.Keys)
{
Response.Write(key+"="+Request.QueryString[key] + "<br />");
}
Response.Write("Request.QueryString:End <br/>");
Response.Write("Request.Params:");
foreach (string key in Request.Params.Keys)
{
Response.Write(String.Format("{0}: {1}<br />", key, Request.Params[key]));
}
}
            if (Request.Cookies != null)
{
for (int i = 0; i < Request.Cookies.Count; i++)
{
Response.Write(Request.Cookies[Request.Cookies.Keys[i]].Value); }
}
 Dictionary<string, object> dict = we.TheRest;
//Response.Write(we.TheRest["WD"].ToString());
//for (int i = 0; i < dict.Count; i++)
//{
// Response.Write(dict.Keys.ToString());
// Response.Write(dict.Values.ToString()); //}
foreach (KeyValuePair<string, object> kvp in dict)
{
//outputBlock.Text += String.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
string s = string.Format("键是:{0} 值是:{1}", kvp.Key.ToString(), (!object.Equals(kvp.Value, null) ? kvp.Value.ToString(): ""));
Response.Write(s);
} //Hashtable dict = new Hashtable();
//foreach (DictionaryEntry i in dict)
//{
// string s = string.Format("键是:{0} 值是:{1}", i.Key.ToString(), i.Value.ToString());
// Response.Write(s);
//} }

csharp: Request.Form,Request.QueryString,Request.Params,Request.Cookies的更多相关文章

  1. Request.params,Request.form,Request.querystring区别(转)

    自己总结:---大致意思是: 1.传参的方式分为:get方式传参,post方式传参,request.cookies和request.servervariables 2.这几种获取参数方式获取的都是一个 ...

  2. Request.Form()的使用

    在CS文件中获得对应页面中的下拉框DropDownList_sitebranch值可以有以下几种方法获得:         siteInfo.FZJGID = DropDownList_sitebra ...

  3. request.form()和request()的区别

    Request.Form:获取以POST方式提交的数据(接收Form提交来的数据):Request.QueryString:获取地址栏参数(以GET方式提交的数据)Request:包含以上两种方式(优 ...

  4. System.Web.HttpRequestValidationException: 从客户端(name="<a href=''>我是晓菜鸟</a>")中检测到有潜在危险的 Request.Form 值

    这是一个比较常见的问题了,如果Web表单中有输入类似于 Html 标签之类的文本,在通过 Request.QueryString 或者 Request.Form 传递这些值的时候,就会触发这样的异常, ...

  5. 转载:检测到有潜在危险的 Request.Form 值

    转载:检测到有潜在危险的 Request.Form 值 金刚 ASP.NET Request.Form 这是一篇转载的文章,文章原始出处.点我 这种问题是因为你提交的Form中有HTML字符串,例如你 ...

  6. WebAPI.请求(Request)的参数(Parameter)里包含特殊字符(#等)的正确处理方式 从客户端xx中检测到有潜在危险的Request.Form值

    事故现场 报错"从客户端 中检测到有潜在危险的Request.Form值" //后台代码 namespace Test { [RoutePrefix("TestClass ...

  7. C#中 Request, Request.params , Request.querystring , Request.Form 区别 与联系用法

    C#中 Request, Request.params , Request.querystring , Request.Form 区别 与联系用法? Request.params , Request ...

  8. Request.QueryString["id"] 、Request.Params["id"] 的强大

    <form> <input type="text" name="id" value="值"> </form&g ...

  9. request.querystring和request.form、session的区别

    1. request.querystring是用来接收地址里面问号“?”后面的参数的内容,  用get方法读取的 不安全   request.form是用来接收表单递交来的数据 ,是用post方法读取 ...

随机推荐

  1. HTML5 调用百度地图API地理定位

    <!DOCTYPE html> <html> <title>HTML5 HTML5 调用百度地图API地理定位实例</title> <head&g ...

  2. 2019.2.15 t2

    考虑倒过来计算最短路径长度,设dis[u]表示在最坏情况下,点u到最近的一 个出口的最短路,则p个出口的dis值都是0,答案即为dis[0]. #include <cstdio> #inc ...

  3. hive join的三种优化方式

    原网址:https://blog.csdn.net/liyaohhh/article/details/50697519 hive在实际的应用过程中,大部份分情况都会涉及到不同的表格的连接, 例如在进行 ...

  4. ubuntu 上运行的django 出现No space left on device错误

    运行django出现错误信息: [2016-02-16 14:33:24,476 pyinotify ERROR] add_watch: cannot watch /usr/local/lib/pyt ...

  5. 进阶篇:4.2.6)DFMEA故障库的建立与积累

    本章目的:DFMEA故障库的建立与积累. 1.故障库的认知 故障库是一种数据库,只是这个数据库中储存的是故障模式,也就是失效模式. 从前文DFMEA章节的学习中,我们可以知道,DFMEA对不同层级的失 ...

  6. python正则表达式记录

    元字符: *  星号   它指定前一个字符可以被匹配零次或更多次 >>> re.match('a[bcd]*b', 'abcbdabcd').group() 'abcb' >& ...

  7. QRegExp

    这段代码会越界,百思不得七姐(过了N久时间 之后^^)原来是把i写成了1  --! //#if 0 QRegExp re1("AT+CGATT?"); QRegExp re2(&q ...

  8. C语言实现数组逆置

    #include <stdio.h> #include <assert.h> void swap(int *a ,int *b) { int tmp = *a; *a = *b ...

  9. ffmpeg intro - pull and push

    ffmpeg -i rtmp://rtmp.test.com/live/livestream -c:v copy -c:a copy -f flv rtmp://172.31.11.53/myhls/ ...

  10. TortoiseGit学习系列之TortoiseGit是什么?

    写该文章目的 肯定有人会遇到这样的问题: 最近换了一份新工作,新公司的源码管理都是使用GIT,习惯了之前的TFS和SVN进行项目源码管理和团队开发,第一次使用GIT进行团队开发和源码管理,颇有一些不习 ...