Viewstate problems under load

Forum for users of ANTS web server load testing tool

Viewstate problems under load

Postby code » Fri Jul 28, 2006 8:36 am


I have been testing our .Net web app for several weeks now and the only continual error that I receive during a test run is to do with ViewState.

I had some initial problems setting up the test, as the site I am testing consists of a series of stepped pages (a card application) and if data is not passed correctly after each step, then the app will redirect you to the previous page. These were resolved so I know the test run works as I can see finished card applications being written to the database.

The problem arises when the test has been running for a while. We are currently at 150 virtual clients and we receive the following exception about 100 times an hour:

Code: Select all
System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.InvalidCastException: Specified cast is not valid.
   at System.Web.UI.Page.LoadPageViewState()
   at System.Web.UI.Page.ProcessRequestMain()
   --- End of inner exception stack trace ---
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain()
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I set enableViewStateMac to false in the web.config as this exception was originally manifesting itself as a corrupt viewstate that was deemed invalid.

The error is generated by any of the stepped pages, it is not just tied into a single page, which confuses me slightly.

I was wondering if the error is due to a slow down in the site? When ANTS load is running through a test script, does it wait and wait on a request until timeout, and then continue to the next request in the script if the previous one fails? I so then I guess this would break the application process as the next step would always redirect to the previous, or the beginning depending on what had happened.

I am just trying to get my head round why we are seeing so many of these errors so any pointers would be greatly appreciated.

Many thanks,
Posts: 8
Joined: Wed Jun 28, 2006 2:05 pm

Postby Brian Donahue » Mon Jul 31, 2006 4:15 pm

Hi Tim,

It could be any of these things. I can't even begin to try to help based on this information because 9/10 times it's either something specific to the application or it's the ASPX pages appearing out-of-order in the test script. Please send an email to and we'll see what we can do for you.
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Postby code » Mon Jul 31, 2006 4:39 pm

Sorry, posted this on the wrong thread! ..

Hi Brian,

I have emailed support with all the test scripts and ANTS Load solution.

The site we are testing uses Forms Authentication and the error seems to be triggered during login/logout. When ANTS Load creates all the clients, will they generate authentication cookies specific to themselves or since everything is running from the same domain, will they share the same one? If a client reaches the end of the test script and logs out, will this cause all other clients who are running through the stepped process to error as they are no longer authenticated?

I know it is near impossible to suggest a solution without seeing everything involved so will keep looking.

As I say, support email sent earlier today.

Posts: 8
Joined: Wed Jun 28, 2006 2:05 pm

Postby code » Mon Jul 31, 2006 8:25 pm

Hi Brian,

I was doing a bit more research tonight into the cause of our problem and it seems that at a random point during an iteration of a virtual client's Run method, a request comes back from the web client that has no viewstate value. This empty view state is then being passed to the next request, which generates our error. Our web app does not generate a 500 server error, just a 302 redirect back to the previous request.

The script continues erroring until the end of the Run method is reached. Once it is back at the beginning, everything starts again and it makes it through.

I have a simplified script at work that demonstrates this. I will email it to support in the morning. We are running at 150 virtual clients at the moment.

Thanks in advance.

Posts: 8
Joined: Wed Jun 28, 2006 2:05 pm

Return to ANTS Load

Who is online

Users browsing this forum: No registered users and 0 guests