0

我想用jMeter加載測試我的網站。 我的登錄頁面出現問題。我已經通過正則表達式捕獲它通過在登錄頁面__RequestVerificationToken值,如下所示:jMeter MVC和防僞登錄問題

Field to check: Body. 
Reference Name: token. 
Regular Expression: <input name="__RequestVerificationToken" type="hidden" value="(.*)" />. 
Template: $1$ 

我仍然得到同樣的錯誤與響應爲:從查看請求選項卡

<title>The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the &lt;machineKey&gt; configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster.</title> 
<b> Exception Details: </b>System.Web.Mvc.HttpAntiForgeryException: The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the &lt;machineKey&gt; configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster.<br><br> 

更多細節樹結果:

POST data: 
__RequestVerificationToken=%24%7Btoken%7D&UserModel.UserName=pm&UserModel.Password=Abc1234D 

Cookie Data: 
ASP.NET_SessionId=l0cvy41ons0xv1t3e5glx2j5; __RequestVerificationToken_L0NyZWlzc1dlYg2=elGNi5_GoW2DYFM-obeXg9DHsihM26jv8HgT4IEpjngwc1gfJ4lRTboi3t-UV4L9485dM_9bdAVfRZKauTIXAZoKvNt2Q9R0yW19ZQIO17A1 

Request Headers: 
Connection: keep-alive 
Referer: http://172.52.50.137/CreissWeb/ 
Accept-Language: en-US,en;q=0.5 
Content-Type: application/x-www-form-urlencoded 
Accept-Encoding: gzip, deflate 
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Content-Length: 91 
Host: 172.52.50.137 

HTTP請求:

__RequestVerificationToken ${token} false true 
UserModel.UserName pm false true 
UserModel.Password Abc1234D false true 

任何幫助將不勝感激。 !

+0

您確定__RequestVerificationToken值是否被RegEx按照您的預期捕獲?你需要提供更多的細節。 – vins

+0

謝謝@VinothS。我已經更新了更多細節的問題,請看看。希望有所幫助! –

回答

1

您的正則表達式提取器無法按預期工作。 POST數據清楚地顯示出__RequestVerificationToken=${token}

嘗試將正則表達式更改爲name="__RequestVerificationToken" type="hidden" value="(.*)" &看看是否有幫助。

如果不起作用,請發佈您獲得的HTTP響應。

+0

非常感謝!我會嘗試一下.. –

-1
Exception:The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the &lt;machineKey&gt; configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster., Login,SetLogin 
    at System.Web.Helpers.AntiXsrf.AntiForgeryTokenSerializer.Deserialize(String serializedToken) 
    at System.Web.Helpers.AntiXsrf.AntiForgeryTokenStore.GetFormToken(HttpContextBase httpContext) 
    at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext) 
    at System.Web.Helpers.AntiForgery.Validate() 
    at System.Web.Mvc.ValidateAntiForgeryTokenAttribute.OnAuthorization(AuthorizationContext filterContext) 
    at Cogitate.PPE.Web.Controllers.ValidateAntiForgeryTokenOnAllPosts.OnAuthorization(AuthorizationContext filterContext) 
    at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.&lt;&gt;c__DisplayClass25.&lt;BeginInvokeAction&gt;b__1e(AsyncCallback asyncCallback, Object asyncState) 
+0

這不會提供問題的答案。你可以[搜索類似的問題](// stackoverflow.com/search),或者參考頁面右側的相關和鏈接問題來找到答案。如果你有一個相關但不同的問題,請[提出一個新問題](// stackoverflow.com/questions/ask),幷包含一個鏈接來幫助提供上下文。請參閱:[提問,獲得答案,沒有分心](// stackoverflow.com/tour) – Rob