0
Answered

Invalid viewstate

UKGeneral 5 years ago updated by Ilya (Here to help) 5 years ago 3

Hello,


I have setup and configured Web transaction monitoring which has been working well, however, when a new session is required (for example do not monitor for a while), the monitors fail as sessionstate is no longer valid.


Reviewing the logs, an "Invalid viewstate." error is been raised.

Looking at the details of the transaction recorder includes "&__VIEWSTATE=xxxxxx" into the post of the page. This is recorded from the initial user recording, and does not get changed. I have been trying to use variables try capture the previous pages VIEWSTATE, in an attempt to make the viewstate value change with each monitoring session. Unfortunately I have not been able to get the working thus far.


Viewstate / sessions are pretty common place, so I am asumming their is an easy way to achive this.


Please advise.


Thanks


Answer

+1
PINNED
Under review

Hi,


Yes, need to create variables manually. For your case need to create 3 variables:

- for VIEWSTATE

- for VIEWSTATEGENERATOR

- for EVENTVALIDATION

and then paste it to appropriate request.


To do this:

1. Open transaction recorder

2. Load desired transaction

3. Press Run Transaction button

4. Find steps where this three variables was created. You can find it in Response Data post body



5. On this step in variables section press right click and Add variables

6. Enter appropriate name for variable. Select Regexp for Type and pattern enter(for VIEWSTATE):

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="([0-9a-zA-Z/+=]+)" />

like this:



7. Do the similar for VIEWSTATEGENERATOR, EVENTVALIDATION. Do not forget to change regexp appropriately

8. Go to step where this variables will be using.

9. Copy variables by right click and select 'Copy as URL'

10. Paste this variables to request data body instead of current value:



11. Press Run Transaction button to make sure it is working.

+1
PINNED
Under review

Hi,


Yes, need to create variables manually. For your case need to create 3 variables:

- for VIEWSTATE

- for VIEWSTATEGENERATOR

- for EVENTVALIDATION

and then paste it to appropriate request.


To do this:

1. Open transaction recorder

2. Load desired transaction

3. Press Run Transaction button

4. Find steps where this three variables was created. You can find it in Response Data post body



5. On this step in variables section press right click and Add variables

6. Enter appropriate name for variable. Select Regexp for Type and pattern enter(for VIEWSTATE):

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="([0-9a-zA-Z/+=]+)" />

like this:



7. Do the similar for VIEWSTATEGENERATOR, EVENTVALIDATION. Do not forget to change regexp appropriately

8. Go to step where this variables will be using.

9. Copy variables by right click and select 'Copy as URL'

10. Paste this variables to request data body instead of current value:



11. Press Run Transaction button to make sure it is working.

Great response. Just what I needed.


I had tired all sorts with the Regex but your sample was spot on.

Thank you