JMeter HTTP请求显示无效凭证且未获得通过

时间:2014-09-17 07:18:30

标签: jmeter

我正在测试一个有登录页面的网站,然后是一些我们可以发表评论/发帖的博客。 我首先登录该网站,然后选择一个博客并对该博客发表评论。 我能够传递登录请求并选择博客请求,但对显示错误凭证无效的博客请求发表评论。

以下是回复消息:

Thread Name: Thread Group 1-1
Sample Start: 2014-09-17 12:41:42 IST
Load time: 9
Latency: 9
Size in bytes: 286
Headers size in bytes: 286
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Response code: 403
Response message: Invalid credentials

回复标题:

HTTP/1.1 403 Invalid credentials
Cache-Control: private
Server: Microsoft-IIS/8.5
X-FRAME-OPTIONS: SAMEORIGIN
X-UA-Compatible: IE=Edge
X-Telligent-Evolution: 8.0.0.37997
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 17 Sep 2014 07:11:42 GMT
Content-Length: 0


HTTPSampleResult fields:
ContentType: 
DataEncoding: null

这是请求数据:

POST http://192.xx.xx.61/TelligentCommunity/api.ashx/v2/comments.json

POST数据:

Body=This+is+the+sample+post+by+Arjun&ContentId=c6bc2886-1fcb-46a4-8120-e344b8d8e4a1&ContentTypeId=f7d226ab-d59f-475c-9d22-

Cookie数据:

AuthorizationCookie=71710e44-7ba7-4af7-b390-6ae81cdec229; .Telligent.Evolution=F426475F7F35ED7250E97697BCC3DE0147BD3D15C494681A9C188922459CC698DD6F6A0CA77D61E2D5C6A56A5239B338B8DC484DAB6A4073B69F9F9139500867A843A9EB39D217825C47672E1B5165214A990F8E9CF519ED6159591B510967F84F6810CBCC4466E0DA5E37D03AB0E341A6DA0970861A2F58EE873E168D1A851D9B956033B10C9856D680FC6AC5736F961631BDD1A66EE89024020BF55A8422B24A485311C87C5074F2507E4FFA9EFBADC36B0DCBC051965ACE32EDA2B5607FEBDE17F0C2F486A42E05680FD90F30494B

请求标题:

Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Rest-Authorization-Code: 7a24113f-2a71-428b-80c7-57234aac67c1
Accept-Language: en-US
Accept: */*
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
DNT: 1
Pragma: no-cache
Authorization-Code: 7a24113f-2a71-428b-80c7-57234aac67c1
X-Requested-With: XMLHttpRequest
Referer: http://192.xx.xx.61/TelligentCommunity/certification/b/90days2mcsa/archive/2014/09/12/how-to-win-by-contributing-to-the-mcp-community
Accept-Encoding: gzip, deflate
Content-Length: 123
Host: 192.xx.xx.61

1 个答案:

答案 0 :(得分:0)

  1. 您确定您的登录请求是否成功?你怎么知道的? ASP.NET应用程序使用viewstateeventvalidation等动态参数,需要从之前的响应中提取它们并添加到下一个响应中。有关详细信息,请参阅ASP.NET Login Testing with JMeter指南。

  2. 查看apijson个网址位,我希望Content-Type标头应为application/json。我建议添加一个HTTP Header Manager作为请求的子项,发布博客评论并将其配置为发送上面的Content-Type。

  3. Authorization-Code标头值:是您录制的内容还是来自关联?如果首先你也需要传递正确的值。