I'm having some problems getting the __VIEWSTATE and __EVENTVALIDATION parameters. I'm using a post procesor Regular Expression Extractor and configuring them as follows:
Reference Name: aspViewstate
Regular Expression: name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"
Template: $1$
Match No. (0 for Random): 1
Default value: ERROR_VIEWSTATE
Reference Name: aspEventValidation
Regular Expression: name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.+?)"
Template: $1$
Match No. (0 for Random): 1
Default value: ERROR_EventValidation
Then, Im replacing in the http request the values of each parameters for ${aspViewstate} and ${aspEventValidation} respectively.
I'm putting the Regular Expression Extractors below the GET request and before the POST request.
I'm including a Debug Sampler and Im getting the "error result":
aspEventValidation=ERROR_EventValidation
aspViewstate=ERROR_VIEWSTATE
Please can any one help me about what I'm missing....
UPDATE: I'm getting the __VIEWSTATE using the CSS/JQuery Extractor like follow and is working:
CSS/JQuery Extractor Implementation:JSOUP
Reference Name: aspViewstate
CSS/JQuery Expression: input[id=__VIEWSTATE]
Attribute: value
Template: $1$
Match No. (0 for Random): 0
Default value: ERROR
but for the __EVENTVALIDATION is not working, and Im using the same sintax:
CSS/JQuery Extractor Implementation:JSOUP
Reference Name: aspEventValidation
CSS/JQuery Expression: input[id=__EVENTVALIDATION]
Attribute: value
Template: $1$
Match No. (0 for Random): 0
Default value: ERROR
I don't know what is failing...
About the VIEWSTATE Im getting already the value but the system is sending me the following error, is like is not sending the VIEWSTATE...
Error:
<code><pre>
[FormatException: The input is not a valid Base64 string that contains a character that is not Base 64, more than two filler characters or an invalid character among the padding characters . ]
System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) +14115992
System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +162
System.Convert.FromBase64String(String s) +56
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +102
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +67
System.Web.UI.HiddenFieldPageStatePersister.Load() +200
[ViewStateException: View state invalid
Client IP:
Port:
Referer: http://Art/WebLogiPortal/wfmLoginD.aspx?ReturnUrl=%2fArt%2fWebLogiPortal%2fwfmDefault.aspx
Path: /Art/WebLogiPortal/wfmLoginD.aspx
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
ViewState: ${aspViewstate}]
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +157
System.Web.UI.HiddenFieldPageStatePersister.Load() +12060517
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +12315765
System.Web.UI.Page.LoadAllState() +51
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12308619
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +12308137
System.Web.UI.Page.ProcessRequest() +119
System.Web.UI.Page.ProcessRequest(HttpContext context) +99
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
</pre></code>
I added a Debug Post procesor and I realized that the sent value to the server was litterally the characters of the variable (i.e ${viewstate}) and not the value, not even the default value (error). What can possibly be happening ?
Here is the Response date of the Debug Post procesor:
HTTPSampler.response_timeout=
HTTPSampler.use_keepalive=true
HTTPsampler.Arguments=wucLoginPortal_ScriptManager1_HiddenField=&__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=${aspViewstate}&__VIEWSTATEGENERATOR=${viewstateGenerator}&__EVENTVALIDATION=${aspEventValidation}&wucLoginPortal$__LBLHDN__=&wucLoginPortal$txtLoginAD=user1&wucLoginPortal$txtPasswordAD=user1&wucLoginPortal$txtDominioAD=art.com&wucLoginPortal$btnAceptarAD=Aceptar
TestElement.enabled=true
TestElement.gui_class=org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui
TestElement.name=4 /Art/WebLogiPortal/wfmLoginD.aspx?ReturnUrl=%2fArt%2fWebLogiPortal%2fwfmDefault.aspx
TestElement.test_class=org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy
TestPlan.comments=Detected the start of a redirect chain
I wouldn't recommend using Regular Expression Extractor to fetching viewstate and eventvalidation values as in case of changing attributes location, or being on multiple lines or having an extra space may cause your regex to fail.
JMeter provides 2 test elements designed to extract values from HTML pages, they are:
Example XPath locator will look like:
//input[@id='__VIEWSTATE']/@value
Example CSS selector will be
input[id=__VIEWSTATE]
specify value
in "Attribute" input
See ASP.NET Login Testing with JMeter guide for more details and recommendations.
User contributions licensed under CC BY-SA 3.0