csharp: Request.Form,Request.QueryString,Request.Params,Request.Cookies
/// <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的更多相关文章
- Request.params,Request.form,Request.querystring区别(转)
自己总结:---大致意思是: 1.传参的方式分为:get方式传参,post方式传参,request.cookies和request.servervariables 2.这几种获取参数方式获取的都是一个 ...
- Request.Form()的使用
在CS文件中获得对应页面中的下拉框DropDownList_sitebranch值可以有以下几种方法获得: siteInfo.FZJGID = DropDownList_sitebra ...
- request.form()和request()的区别
Request.Form:获取以POST方式提交的数据(接收Form提交来的数据):Request.QueryString:获取地址栏参数(以GET方式提交的数据)Request:包含以上两种方式(优 ...
- System.Web.HttpRequestValidationException: 从客户端(name="<a href=''>我是晓菜鸟</a>")中检测到有潜在危险的 Request.Form 值
这是一个比较常见的问题了,如果Web表单中有输入类似于 Html 标签之类的文本,在通过 Request.QueryString 或者 Request.Form 传递这些值的时候,就会触发这样的异常, ...
- 转载:检测到有潜在危险的 Request.Form 值
转载:检测到有潜在危险的 Request.Form 值 金刚 ASP.NET Request.Form 这是一篇转载的文章,文章原始出处.点我 这种问题是因为你提交的Form中有HTML字符串,例如你 ...
- WebAPI.请求(Request)的参数(Parameter)里包含特殊字符(#等)的正确处理方式 从客户端xx中检测到有潜在危险的Request.Form值
事故现场 报错"从客户端 中检测到有潜在危险的Request.Form值" //后台代码 namespace Test { [RoutePrefix("TestClass ...
- C#中 Request, Request.params , Request.querystring , Request.Form 区别 与联系用法
C#中 Request, Request.params , Request.querystring , Request.Form 区别 与联系用法? Request.params , Request ...
- Request.QueryString["id"] 、Request.Params["id"] 的强大
<form> <input type="text" name="id" value="值"> </form&g ...
- request.querystring和request.form、session的区别
1. request.querystring是用来接收地址里面问号“?”后面的参数的内容, 用get方法读取的 不安全 request.form是用来接收表单递交来的数据 ,是用post方法读取 ...
随机推荐
- 2019.2.15 t3 平均值
#include <cstdio> #include <iostream> #include <cstring> #include <cmath> #i ...
- thinkphp3.2----实现伪静态和路由配置
URL模式: 0.普通 http://localhost/qixin/ThinkCMF(test)_backup/index.php?g=user&m=login&a=index ...
- 《[MySQL技术内幕:SQL编程》读书笔记
<[MySQL技术内幕:SQL编程>读书笔记 2019年3月31日23:12:11 严禁转载!!! <MySQL技术内幕:SQL编程>这本书是我比较喜欢的一位国内作者姜承尧, ...
- linux源码中的核心数据结构
寄存器 pt_regs 进程线程 struct task_struct: 进程,或者是线程数据结构,在include/linux/sched.h里面定义的,与硬件体系结构无关 struct threa ...
- openstack中安装包与组件
keystone openstack-keystone:验证服务,openstack 中的所有组件的验证以及用户验证,权限,目录等服务. python-openstackclient:命令行,安装以后 ...
- html5兼容问题
1.html5对于ie9一下的版本不支持,所以我们可以添加(你可以下载至本地): <!--[if lt IE 9]> <script src="http://cdn.sta ...
- js 下不同浏览器,new Date转换结果时差
项目中在android上使用XWalkView作为浏览器,发现在解析时间的时候解析结果和实际结果有时差. android联机调试的截图如下: PC本机调试截图如下: 从android联机调试的截图看, ...
- 文献综述十四:基于Oracle11g的超市进销存管理系统设计与实现
一.基本信息 标题:基于Oracle11g的超市进销存管理系统设计与实现 时间:2016 出版源:技术创新 文件分类:对数据库的研究 二.研究背景 为超市设计开发的超市管理系统,采用的是 VC+ Or ...
- SpringCloud---消息驱动的微服务---Spring Cloud Stream
1.概述 1.1 Spring Cloud Stream:用来 为微服务应用 构建 消息驱动能力的框架: 可基于SpringBoot来创建独立.可用于生产的Spring应用程序: 使用Sp ...
- C 六度空间理论的实现
“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论.这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够 ...