1

我在 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  

是什么导致参数没有被替换?

我该如何解决这个错误?

4

0 回答 0