I am recording a script in which i made the correlation of viewstate . the problem is that the viewstate i m recieving in response is non- encoded viewstate i.e. "/wEPDwUKLTYwNjA5MjIxM2QYAQUeX19Db250cm9sc1JlcXVpcmV Qb3N0QmFja0tleV9fFgIFD2ltZ05vdGlmaWNhdGlvbgUMaW1nV 2hpdGVIYWxsflzEKZgd3plzB4Q82y3pV5jIXgE="
and viewstate i.e. send in request is " %2FwEPDwUKLTc3ODk3ODQ5MA9kFgICAQ9kFgICAQ9k" &
"FgQCAQ8PFgIeBFRleHRlZGQCAw9kFgQCAg9kFgICAQ9kFgJmD w9kFgQeCm9ua2V5cHJlc3MFJHJldHVybiBjbGlja0J1dHR" &
"vbihldmVudCwnYnRuTG9naW4nKR4FVmFsdWVlZAIED2QWAgIB D2QWAgIBDxBkEBUBCEZpbmVEb2NzFQEIRmluZURvY3MUKw" &
"MBZ2RkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXl fXxYBBQ1jaGtCeFJlbWVtYmVy1G2ccK6TxKGIzCAWL2P8L" &
my question is how i can encode the recieving viewstate
Unfortunately there isn't any encode/decode within OpenSTA but you could write a procedure to do it for you.
There are only a couple of things there that need encoding in your example, I'm not entirely convinced that Viewstate uses many characters that need encoding. In your example, it's onlt the / at the front and the = at the end.
/ = %2F
= = %3D
So you just need to write a function to replace one with the other, a bit like this:
== Declare these ==
sViewState = character (contains your unencoded viewstate)
i = integer
sTempChar = character
sTemp = character (same size as sviewstate)
== CODE ==
SET sTemp = ""
!-- Need to replace "=" with "%3D"
set pstrlen = ~LENGTH(sViewState)
DO i = 0, pstrlen
set sTempChar = ~EXTRACT(i,1,sViewState)
IF(sTempChar ="=") THEN
SET sTemp = sTemp+"%3D"
SET sTemp = sTemp+sTempChar
set sViewState = sTemp
Then do it again for each different character you want to replace. Remember that the viewstate at the end will be bigger than the viewstate at the beginning as '%3D' is 3 characters whereas '=' is only 1.
Everywhere's within walking distance if you have enough time.