[原创] web_custom_request 与 Viewstate
在用loadrunner对.net编写的website进行性能测试时,经常会遇上一些hidden fields,例如,CSRFTOKEN、VIEWSTATE、EVENTVALIDATION等,而对于这些hidden field,有时候需要进行前后关联。但是最近发现一个很奇怪的现象:已经通过web_reg_save_param_regexp函数准确的获取了这些hidden fields,并且所得的param在web_submit_data可以正常使用,但是用在web_custom_request时却总是报错,百思不得其解!经过google后终于弄明白了:
进行关联通常用到的都是web_reg_save_param、web_reg_save_param_ex、web_reg_save_param_regexp这三个函数,需要注意的是这三个函数拿回来的param的值都是html编码的。
对于html编码的param,web_submit_data函数可以直接使用,但是web_custom_request则不可以直接使用,而需要通过函数web_convert_param先转换为url编码才可以,否则是会产生error的。
int web_convert_param( const char *ParamName, [char *SourceString] char *SourceEncoding, char *TargetEncoding, LAST );
The following example uses web_convert_param to convert HTML strings to URL and plain text formats.
The Web page has these texts:
Sample HTML code to be converted: <mytag>& End
Sample plain text to be converted: 1–AD X=0+2 End
Action()
{
web_reg_save_param("HTML",
"LB=Sample HTML code to be converted: ",
"RB= End",
LAST );
web_reg_save_param("HTML1",
"LB=Sample HTML code to be converted: ",
"RB= End",
LAST );
web_reg_save_param("Plaintext",
"LB=Sample plain text to be converted: ",
"RB= End",
LAST );
web_url("web_url",
"URL=http://lazyboy/html/convert_param_page.html",
"TargetFrame=",
"Resource=0",
"Referer=",
LAST );
web_convert_param("HTML", "SourceEncoding=HTML",
"TargetEncoding=URL", LAST );
web_convert_param("HTML1", "SourceEncoding=HTML",
"TargetEncoding=PLAIN", LAST );
web_convert_param("Plaintext", "SourceEncoding=HTML",
"TargetEncoding=URL", LAST );
web_reg_save_param("Result",
"LB=<code>entry = ",
"RB=</code>",
LAST );
web_custom_request("web_custom_request",
"URL=http://lazarus/cgi–bin/post_query.exe",
"Method=POST",
"TargetFrame=",
"Resource=0",
"Referer=",
"Body=entry={Plaintext},{HTML}",
LAST );
return 0;
}
The following section shows the relevant sections of the log file that resulted from running the above segment:
Running Vuser...
Action.c(21): Saving Parameter "HTML = <mytag>&"
Action.c(21): Saving Parameter "HTML1 = <mytag>&"
Action.c(21): Saving Parameter "Plaintext = 1–AD X=0+2"
After web_url:
Action.c(28): Saving Parameter "HTML = %3Cmytag%3E%26"
Action.c(28): web_convert_param was successful
Action.c(29): Saving Parameter "HTML1 = <mytag>&"
Action.c(29): web_convert_param was successful
Action.c(30): Saving Parameter "Plaintext = 1–AD+X%3D0%2B2"
Action.c(30): web_convert_param was successful
web_custom_request:
Action.c(37): Parameter Substitution: parameter "Plaintext" = "1–AD+X%3D0%2B2"
Action.c(37): Parameter Substitution: parameter "HTML" = "%3Cmytag%3E%26"
Action.c(37): Saving Parameter "Result = 1–AD X=0+2,<mytag>&"
This example shows the use of the SourceString argument. Note that the source string can contain parameters. The source string is first evaluated, replacing parameters with their values, then converted to PLAIN. The result is stored in parameter "targetParam."
web_convert_param(
"targetParam",
"SourceString={param1}abc{param2}",
"SourceEncoding=HTML",
"TargetEncoding=PLAIN",
LAST );
[原创] web_custom_request 与 Viewstate的更多相关文章
- ASP.NET保存信息总结(Application、Session、Cookie、ViewState和Cache等) ZT
http://www.cnblogs.com/ranran/p/4065619.html http://www.cnblogs.com/jxlsomnus/p/4450911.html 以下是关于AS ...
- [ASP.net教程]ASP.NET保存信息总结(Application、Session、Cookie、ViewState和Cache等)
以下是关于ASP.NET中保存各种信息的对象的比较,理解这些对象的原理,对制作完善的程序来说是相当有必要的(摘至互联网,并非原创--xukunping)在ASP.NET中,有很多种保存信息的对象.例如 ...
- 转:web_custom_request 和 web_submit_data的差别
web_custom_request方法可以发送POST和GET类型的请求 web_submit_data只能发送POST类型的请求 所有web_submit_data方法发送的请求都可以使用web_ ...
- ASP.NET保存信息总结(Application、Session、Cookie、ViewState和Cache等)
以下是关于ASP.NET中保存各种信息的对象的比较,理解这些对象的原理,对制作完善的程序来说是相当有必要的(摘至互联网,并非原创--xukunping) 在ASP.NET中,有很多种保存信息的对象.例 ...
- web_custom_request和web_submit_data
网络上很多说明这2个函数区别的文章,我就从其他摘抄了内容,其中区别自己查看附录,我主要说明2点 (1)用web_custom_request提交请求如果是json,则会会使用关键字符{},但是{},是 ...
- 【原创分享·支付宝支付】HBuilder打包APP调用支付宝客户端支付
前言 最近有点空余时间,所以,就研究了一下APP支付.前面很早就搞完APP的微信支付了,但是由于时间上和应用上的情况,支付宝一直没空去研究.然后等我空了的时候,发现支付宝居然升级了支付逻辑,虽然目前还 ...
- 【原创分享·微信支付】C# MVC 微信支付教程系列之现金红包
微信支付教程系列之现金红包 最近最弄这个微信支付的功能,然后扫码.公众号支付,这些都做了,闲着无聊,就看了看微信支付的其他功能,发现还有一个叫“现金红包”的玩意,想 ...
- 【原创分享·微信支付】 C# MVC 微信支付教程系列之扫码支付
微信支付教程系列之扫码支付 今天,我们来一起探讨一下这个微信扫码支付.何为扫码支付呢?这里面,扫的码就是二维码了,就是我们经常扫一扫的那种二维码图片,例如,我们自己添 ...
- 【原创分享·微信支付】 C# MVC 微信支付教程系列之公众号支付
微信支付教程系列之公众号支付 今天,我们接着讲微信支付的系列教程,前面,我们讲了这个微信红包和扫码支付.现在,我们讲讲这个公众号支付.公众号支付的应用环境常见的用户通过公众号,然后再通 ...
随机推荐
- Openjudge-计算概论(A)-整数的个数
描述: 给定k(1<k<100)个正整数,其中每个数都是大于等于1,小于等于10的数.写程序计算给定的k个正整数中,1,5和10出现的次数.输入输入有两行:第一行包含一个正整数k,第二行包 ...
- NYOJ-791 Color the fence (贪心)
Color the fence 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Tom has fallen in love with Mary. Now Tom w ...
- 判断pc浏览器和手机浏览器方法
一 //平台.设备和操作系统 var system = { win: false, mac: false, xll: f ...
- Hibernate框架--关联映射,一对多,多对多 inverse cascade
回顾Hibernate: 1. hibernate开发环境搭建 ----> 引入jar: hibernate.jar + required + jpa + 驱动包 ---> hiberna ...
- Git单独checkout子目录
http://schacon.github.io/git/git-read-tree.html#_sparse_checkout Existing Repository If you already ...
- C# 鼠标事件弹框
if (e.Button == MouseButtons.Right) { if (gridView1.GetFocusedRowCellValue("color").ToStri ...
- Python识别网站验证码
http://drops.wooyun.org/tips/6313 Python识别网站验证码 Manning · 2015/05/28 10:57 0x00 识别涉及技术 验证码识别涉及很多方面的内 ...
- hdu_4521_小明系列问题——小明序列(LIS)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4521 题意:中文题,不解释 题解:这题就是LIS的加强版,可以用二分的nlogn来做,也可以用线段树的 ...
- svnserve: E000098: 不能绑定服务器套接字: 地址已在使用
百度一下,所有资料都是 1.查找出目前正在使用的svnserve进程,然后kill掉 ps -aux | grep svnserve kill -9 xxx // xxx代表svnserve对 ...
- 自己写的select元素可编辑、可筛选JQuery插件 jquery.inputselectbox.js
/* 功能:实现对select下拉框可输入的功能, 输入时会对下拉框的内容进行动态过滤. 参数:没有选择任何值时默认显示的文字 如何使用:$("#firstLevel").inpu ...