我在ASP.NET中有一个简单的登录表单,我将EventValidation和ViewState变量保存到参数中:
web_reg_save_param_regexp(
"ParamName=EventValidationParameter",
"RegExp=id=\"__EVENTVALIDATION\"\\ value=\"(.*?)\"\\ ",
SEARCH_FILTERS,
"Scope=Body",
"IgnoreRedirections=No",
"RequestUrl=*/Login.aspx*",
LAST);
web_reg_save_param_regexp(
"ParamName=ViewStateParameter",
"RegExp=id=\"__VIEWSTATE\"\\ value=\"(.*?)\"\\ ",
SEARCH_FILTERS,
"Scope=Body",
"IgnoreRedirections=No",
"RequestUrl=*/Login.aspx*",
LAST);
加载表单后,我提交了这两个参数,以及用户名和密码:
web_submit_data("Login.aspx_2",
"Action=http://myurl.es/Login.aspx",
"Method=POST",
"RecContentType=text/html",
"Referer=http://myurl.es/Login.aspx",
"Snapshot=t3.inf",
"Mode=HTML",
ITEMDATA,
"Name=__EVENTTARGET", "Value=", ENDITEM,
"Name=__EVENTARGUMENT", "Value=", ENDITEM,
"Name=__VIEWSTATE", "Value={ViewStateParameter}", ENDITEM,
"Name=__EVENTVALIDATION", "Value={EventValidationParameter}", ENDITEM,
"Name=logOn$UserName", "Value={UserNameParameter}", ENDITEM,
"Name=logOn$Password", "Value={PasswordParameter}", ENDITEM,
"Name=logOn$btnLogin", "Value=Entrar", ENDITEM,
EXTRARES,
"URL=/favicon.ico", ENDITEM,
LAST);
当我尝试重放脚本时出现问题,因为LoadRunner没有替换参数,所以它发送的是名称而不是它们的值:
__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%7BViewStateParameter%7D&__EVENTVALIDATION=%7BEventValidationParameter%7D&logOn%24UserName=%7BUserNameParameter%7D&logOn%24Password=%7BPasswordParameter%7D&logOn%24btnLogin=Entrar
但正确存储它们,正如我在运行时数据中看到的那样:
ViewStateParameter: /wEPDwUJNTkxMzQ5ODkyZGTb80dGltreV5eu7t3Sx4tukVlYVQ==
EventValidationParameter: /wEWBAKjqI3jCgKq8IegAwK5hoWUBwKTwO3qCT0Isk6sckIUnI6YemgcYsthpZpu
是什么导致参数不被替换?
如何解决此错误?