Search code examples
asp.netjmeterviewstate

Do I need to send all ViewState fields in JMeter?


I'm trying to test an ASP.Net web application using JMeter but I am getting an error page in the second step after navigating to another page. I think this is something to do with ViewState. When I inspect the page, the __VIEWSTATEFIELDCOUNT = 33 and they are named __VIEWSTATE1, __VIEWSTATE2 etc.. Why would there be more than 1 ViewState? Do I need to send every one of these as parameters in my request from JMeter?

Thanks, any help is appreciated


Solution

  • Most probably this is due to ViewState Chunking so in case of very large ViewState it can be split into several parts as some routers/firewalls limit single request parameter length and large viewstates might not fit into the limitation.

    So in order to successfully mimic real browser request you need to correlate all the viewstate fields (including __VIEWSTATEFIELDCOUNT)

    Also don't forget to add HTTP Cookie Manager to your Test Plan to represent browser cookies and deal with cookie-based authentication and correlate other possible dynamic fields like __EVENTVALIDATION

    More information: ASP.NET Login Testing with JMeter