You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by James Clark <jc...@bsd.uchicago.edu> on 2003/10/27 21:04:43 UTC

ASP.NET __VIEWSTATE problem

I am attempting to load test a simple ASP.NET application, which GETS a 
default login page and then POSTS login information back to that page, 
but I'm getting an exception from .NET that it doesn't like the 
__VIEWSTATE (hidden variable that .NET uses to track state of form 
variables) data I'm posting. I'm pursuing a fix for this from the .NET 
side, but my guess is that a fairly simple change will get JMeter to 
handle __VIEWSTATE. Apparently, .NET does some verification that the 
page hasn't been tampered with and I'm guessing that that check is 
seeing some difference between what the initial GET request receives and 
what I'm extracting and posting back. I don't see any difference but 
it's a huge random string, so hard to tell.

I'm using JMeter 1.9.1 with JDK 1.4 on WinXP. Any insights welcome. TIA

TestPlan looks like this:

ThreadGroup (for now, 1 thread)
|--UserParameters (__CSVRead's login info)
|--HTTP Request Defaults
|--HTTP Request (GET default login aspx page)
  |--Regex Extractor (extract the VIEWSTATE value: see below for details)
|--HTTP Request (POST login info UserParameters and VIEWSTATE extracted 
info: see below for details)
|--various listeners


The regex:
reference name:     viewstate
regular expression: name="__VIEWSTATE" value="(.*)"
template:        $0$
match no:        1
default value:      ERROR


the HTTP POST request:
Name:            __VIEWSTATE   
value:            ${viewstate_g1}   
encoded?:        false  (I also try 'true' which gives a different 
exception, see below)
include equals?:    true


The server responds:

The viewstate is invalid for this page and might be corrupted.
Exception Details: System.Web.HttpException: The viewstate is invalid 
for this page and might be corrupted.
[HttpException (0x80004005): The viewstate is invalid for this page and 
might be corrupted.]
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +149
   System.Web.UI.Page.LoadPageViewState() +18
   System.Web.UI.Page.ProcessRequestMain() +423



If I change the POST requests encoding to 'true' I get a different 
error--I think that the viewstate is already encoded and setting this 
true scrambles it, so I just provide this to be complete.

Index was outside the bounds of the array.
[IndexOutOfRangeException: Index was outside the bounds of the array.]
   omcct.defaultForm.Button1_Click(Object sender, EventArgs e) in 
\\blah\default.aspx.vb:102
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String 
eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler 
sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1277


FWIW, I have followed M$' advice and tried turning off some things on 
the server side (Page directives), to no avail:
EnableViewState="false"
EnableViewStateMAC="false" 

###



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: ASP.NET __VIEWSTATE problem

Posted by James Clark <jc...@bsd.uchicago.edu>.
Thanks to both for your input.

I added headers copied from the proxy session, making sure that 
'referer' and 'user-agent' were included, but still no joy.

I also looked again at the encoding of the __VIEWSTATE and  fwiw I think 
that the 2nd way I ran the test, which did encode the data, matches what 
the browser does. Of course, that doesn't work either, but at least it 
shows a different error ("IndexOutOfRangeException" --at the bottom of 
original message below).

A co-worker had Microsoft's Application Center which does some primitive 
testing and we actually got that to work, so I know this is possible, 
but I'm out of ideas on what to change with JMeter, so any additional 
suggestions are most welcome.

Thanks

-- 
James Clark


peter lin wrote:

>  
> hmm, I was able to use JMeter to test webservices .asmx pages when i worked on the webserviceSampler.
>  
> I was also able to test a simple .asp page. When I get some time tomorrow, I'll try to test an .aspx page.
>  
> peter
>  
> 
> 
> mstover1@apache.org wrote:
> A long time ago I debugged an issue for some folks doing .NET 
> stuff, and this sounds familiar. The solution was that they had to 
> include the headers that real browsers send, and so that is when 
> JMeter began recording headers along with request info with the 
> proxy recorder. 
> 
> I don't know if it's the "user-agent" header or "referrer" that .NET 
> looks for, but it solved the problem. If your problem is the same, 
> try recording your test case with the proxy recorder and leave the 
> HeaderManagers in.
> 
> Or, it could be something else :-)
> 
> On 27 Oct 2003 at 14:04, James Clark wrote:
> 
> 
>>I am attempting to load test a simple ASP.NET application, which GETS a 
>>default login page and then POSTS login information back to that page, 
>>but I'm getting an exception from .NET that it doesn't like the 
>>__VIEWSTATE (hidden variable that .NET uses to track state of 
> 
> form 
> 
>>variables) data I'm posting. I'm pursuing a fix for this from the 
> 
> .NET 
> 
>>side, but my guess is that a fairly simple change will get JMeter 
> 
> to 
> 
>>handle __VIEWSTATE. Apparently, .NET does some verification 
> 
> that the 
> 
>>page hasn't been tampered with and I'm guessing that that check 
> 
> is 
> 
>>seeing some difference between what the initial GET request 
> 
> receives and 
> 
>>what I'm extracting and posting back. I don't see any difference 
> 
> but 
> 
>>it's a huge random string, so hard to tell.
>>
>>I'm using JMeter 1.9.1 with JDK 1.4 on WinXP. Any insights 
> 
> welcome. TIA
> 
>>TestPlan looks like this:
>>
>>ThreadGroup (for now, 1 thread)
>>|--UserParameters (__CSVRead's login info)
>>|--HTTP Request Defaults
>>|--HTTP Request (GET default login aspx page)
>>|--Regex Extractor (extract the VIEWSTATE value: see below 
> 
> for details)
> 
>>|--HTTP Request (POST login info UserParameters and 
> 
> VIEWSTATE extracted 
> 
>>info: see below for details)
>>|--various listeners
>>
>>
>>The regex:
>>reference name: viewstate
>>regular expression: name="__VIEWSTATE" value="(.*)"
>>template: $0$
>>match no: 1
>>default value: ERROR
>>
>>
>>the HTTP POST request:
>>Name: __VIEWSTATE 
>>value: ${viewstate_g1} 
>>encoded?: false (I also try 'true' which gives a different 
>>exception, see below)
>>include equals?: true
>>
>>
>>The server responds:
>>
>>The viewstate is invalid for this page and might be corrupted.
>>Exception Details: System.Web.HttpException: The viewstate is 
> 
> invalid 
> 
>>for this page and might be corrupted.
>>[HttpException (0x80004005): The viewstate is invalid for this 
> 
> page and 
> 
>>might be corrupted.]
>>
> 
> System.Web.UI.Page.LoadPageStateFromPersistenceMedium() 
> +149
> 
>>System.Web.UI.Page.LoadPageViewState() +18
>>System.Web.UI.Page.ProcessRequestMain() +423
>>
>>
>>
>>If I change the POST requests encoding to 'true' I get a different 
>>error--I think that the viewstate is already encoded and setting 
> 
> this 
> 
>>true scrambles it, so I just provide this to be complete.
>>
>>Index was outside the bounds of the array.
>>[IndexOutOfRangeException: Index was outside the bounds of 
> 
> the array.]
> 
>>omcct.defaultForm.Button1_Click(Object sender, EventArgs e) 
> 
> in 
> 
>>\\blah\default.aspx.vb:102
>>System.Web.UI.WebControls.Button.OnClick(EventArgs e) 
> 
> +108
> 
>>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv
> entHandler.RaisePostBackEvent(String 
> 
>>eventArgument) +57
>>
> 
> System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandle
> r 
> 
>>sourceControl, String eventArgument) +18
>>
> 
> System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 
> postData) +33
> 
>>System.Web.UI.Page.ProcessRequestMain() +1277
>>
>>
>>FWIW, I have followed M$' advice and tried turning off some 
> 
> things on 
> 
>>the server side (Page directives), to no avail:
>>EnableViewState="false"
>>EnableViewStateMAC="false" 
>>
>>###
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: jmeter-user-
> 
> unsubscribe@jakarta.apache.org
> 
>>For additional commands, e-mail: jmeter-user-
> 
> help@jakarta.apache.org
> 
> 
> 
> 
> 
> --
> Michael Stover
> mstover1@apache.org
> Yahoo IM: mstover_ya
> ICQ: 152975688
> AIM: mstover777
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears




---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: ASP.NET __VIEWSTATE problem

Posted by peter lin <jm...@yahoo.com>.
 
hmm, I was able to use JMeter to test webservices .asmx pages when i worked on the webserviceSampler.
 
I was also able to test a simple .asp page. When I get some time tomorrow, I'll try to test an .aspx page.
 
peter
 


mstover1@apache.org wrote:
A long time ago I debugged an issue for some folks doing .NET 
stuff, and this sounds familiar. The solution was that they had to 
include the headers that real browsers send, and so that is when 
JMeter began recording headers along with request info with the 
proxy recorder. 

I don't know if it's the "user-agent" header or "referrer" that .NET 
looks for, but it solved the problem. If your problem is the same, 
try recording your test case with the proxy recorder and leave the 
HeaderManagers in.

Or, it could be something else :-)

On 27 Oct 2003 at 14:04, James Clark wrote:

> I am attempting to load test a simple ASP.NET application, which GETS a 
> default login page and then POSTS login information back to that page, 
> but I'm getting an exception from .NET that it doesn't like the 
> __VIEWSTATE (hidden variable that .NET uses to track state of 
form 
> variables) data I'm posting. I'm pursuing a fix for this from the 
.NET 
> side, but my guess is that a fairly simple change will get JMeter 
to 
> handle __VIEWSTATE. Apparently, .NET does some verification 
that the 
> page hasn't been tampered with and I'm guessing that that check 
is 
> seeing some difference between what the initial GET request 
receives and 
> what I'm extracting and posting back. I don't see any difference 
but 
> it's a huge random string, so hard to tell.
> 
> I'm using JMeter 1.9.1 with JDK 1.4 on WinXP. Any insights 
welcome. TIA
> 
> TestPlan looks like this:
> 
> ThreadGroup (for now, 1 thread)
> |--UserParameters (__CSVRead's login info)
> |--HTTP Request Defaults
> |--HTTP Request (GET default login aspx page)
> |--Regex Extractor (extract the VIEWSTATE value: see below 
for details)
> |--HTTP Request (POST login info UserParameters and 
VIEWSTATE extracted 
> info: see below for details)
> |--various listeners
> 
> 
> The regex:
> reference name: viewstate
> regular expression: name="__VIEWSTATE" value="(.*)"
> template: $0$
> match no: 1
> default value: ERROR
> 
> 
> the HTTP POST request:
> Name: __VIEWSTATE 
> value: ${viewstate_g1} 
> encoded?: false (I also try 'true' which gives a different 
> exception, see below)
> include equals?: true
> 
> 
> The server responds:
> 
> The viewstate is invalid for this page and might be corrupted.
> Exception Details: System.Web.HttpException: The viewstate is 
invalid 
> for this page and might be corrupted.
> [HttpException (0x80004005): The viewstate is invalid for this 
page and 
> might be corrupted.]
> 
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() 
+149
> System.Web.UI.Page.LoadPageViewState() +18
> System.Web.UI.Page.ProcessRequestMain() +423
> 
> 
> 
> If I change the POST requests encoding to 'true' I get a different 
> error--I think that the viewstate is already encoded and setting 
this 
> true scrambles it, so I just provide this to be complete.
> 
> Index was outside the bounds of the array.
> [IndexOutOfRangeException: Index was outside the bounds of 
the array.]
> omcct.defaultForm.Button1_Click(Object sender, EventArgs e) 
in 
> \\blah\default.aspx.vb:102
> System.Web.UI.WebControls.Button.OnClick(EventArgs e) 
+108
> 
> 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv
entHandler.RaisePostBackEvent(String 
> eventArgument) +57
> 
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandle
r 
> sourceControl, String eventArgument) +18
> 
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 
postData) +33
> System.Web.UI.Page.ProcessRequestMain() +1277
> 
> 
> FWIW, I have followed M$' advice and tried turning off some 
things on 
> the server side (Page directives), to no avail:
> EnableViewState="false"
> EnableViewStateMAC="false" 
> 
> ###
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-
unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-
help@jakarta.apache.org
> 




--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


---------------------------------
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears

Re: ASP.NET __VIEWSTATE problem

Posted by ms...@apache.org.
A long time ago I debugged an issue for some folks doing .NET 
stuff, and this sounds familiar.  The solution was that they had to 
include the headers that real browsers send, and so that is when 
JMeter began recording headers along with request info with the 
proxy recorder.  

I don't know if it's the "user-agent" header or "referrer" that .NET 
looks for, but it solved the problem.  If your problem is the same, 
try recording your test case with the proxy recorder and leave the 
HeaderManagers in.

Or, it could be something else :-)

On 27 Oct 2003 at 14:04, James Clark wrote:

> I am attempting to load test a simple ASP.NET application, which GETS a 
> default login page and then POSTS login information back to that page, 
> but I'm getting an exception from .NET that it doesn't like the 
> __VIEWSTATE (hidden variable that .NET uses to track state of 
form 
> variables) data I'm posting. I'm pursuing a fix for this from the 
.NET 
> side, but my guess is that a fairly simple change will get JMeter 
to 
> handle __VIEWSTATE. Apparently, .NET does some verification 
that the 
> page hasn't been tampered with and I'm guessing that that check 
is 
> seeing some difference between what the initial GET request 
receives and 
> what I'm extracting and posting back. I don't see any difference 
but 
> it's a huge random string, so hard to tell.
> 
> I'm using JMeter 1.9.1 with JDK 1.4 on WinXP. Any insights 
welcome. TIA
> 
> TestPlan looks like this:
> 
> ThreadGroup (for now, 1 thread)
> |--UserParameters (__CSVRead's login info)
> |--HTTP Request Defaults
> |--HTTP Request (GET default login aspx page)
>   |--Regex Extractor (extract the VIEWSTATE value: see below 
for details)
> |--HTTP Request (POST login info UserParameters and 
VIEWSTATE extracted 
> info: see below for details)
> |--various listeners
> 
> 
> The regex:
> reference name:     viewstate
> regular expression: name="__VIEWSTATE" value="(.*)"
> template:        $0$
> match no:        1
> default value:      ERROR
> 
> 
> the HTTP POST request:
> Name:            __VIEWSTATE   
> value:            ${viewstate_g1}   
> encoded?:        false  (I also try 'true' which gives a different 
> exception, see below)
> include equals?:    true
> 
> 
> The server responds:
> 
> The viewstate is invalid for this page and might be corrupted.
> Exception Details: System.Web.HttpException: The viewstate is 
invalid 
> for this page and might be corrupted.
> [HttpException (0x80004005): The viewstate is invalid for this 
page and 
> might be corrupted.]
>    
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() 
+149
>    System.Web.UI.Page.LoadPageViewState() +18
>    System.Web.UI.Page.ProcessRequestMain() +423
> 
> 
> 
> If I change the POST requests encoding to 'true' I get a different 
> error--I think that the viewstate is already encoded and setting 
this 
> true scrambles it, so I just provide this to be complete.
> 
> Index was outside the bounds of the array.
> [IndexOutOfRangeException: Index was outside the bounds of 
the array.]
>    omcct.defaultForm.Button1_Click(Object sender, EventArgs e) 
in 
> \\blah\default.aspx.vb:102
>    System.Web.UI.WebControls.Button.OnClick(EventArgs e) 
+108
>    
> 
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv
entHandler.RaisePostBackEvent(String 
> eventArgument) +57
>    
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandle
r 
> sourceControl, String eventArgument) +18
>    
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 
postData) +33
>    System.Web.UI.Page.ProcessRequestMain() +1277
> 
> 
> FWIW, I have followed M$' advice and tried turning off some 
things on 
> the server side (Page directives), to no avail:
> EnableViewState="false"
> EnableViewStateMAC="false" 
> 
> ###
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-
unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-
help@jakarta.apache.org
> 




--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688
AIM: mstover777

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org