Solved

__VIEWSTATE - how to know its value ?

Posted on 2009-04-08
9
828 Views
Last Modified: 2012-08-14
Hi,
I need to manage a web-site in Windows program.
The site is written in ASP.NET.
I have problem in making POST.
In the code attached there are POST queries of IE and "My program".
In my program I set values of "ComboBoxes" (there are three of them), get value of VIEWSTATE before POST with GET and all the value send with query.
IE works fine, but my program is redirected to "Error Page".
Could you please look at queries and help me to find out what I am doing wrong.
If reqiured, I can show a full source code of IE Page.

P.S. I have no access to code of Server-side.
P.S2. I have only 195 points available %(
////////////// Internet Explorer   ////////////////////////////////
POST /Reestrs/Reestr/default.aspx?part=Reestrs&1=action|Create@id|-1@contractid|-1@actionback|None HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: https://dealer.beeline.kz/Reestrs/Reestr/default.aspx?part=Reestrs&1=action|Create@id|-1@contractid|-1@actionback|None
Accept-Language: ru
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2; .NET CLR 3.5.21022)
Host: dealer.beeline.kz
Content-Length: 1179
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: lastid=2cf786f0-de05-4f48-97c3-94ffc0ee5054; lasturl=/index.wbp; ASP.NET_SessionId=z4pfkifzv01cptiosyg4edud
 
__VIEWSTATE=dDwxNjQxOTc1OTM2O3Q8O2w8aTwxPjs%2BO2w8dDw7bDxpPDQ%2BO2k8Nj47PjtsPHQ8cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Oz47dDw7bDxpPDA%2BOz47bDx0PDtsPGk8MD47aTwyPjs%2BO2w8dDxwPGw8VmlzaWJsZTs%2BO2w8bzxmPjs%2BPjs7Pjt0PDtsPGk8MD47PjtsPHQ8O2w8aTwwPjs%2BO2w8dDw7bDxpPDE%2BO2k8Mz47aTw1PjtpPDc%2BO2k8MzM%2BO2k8NDc%2BO2k8NTM%2BOz47bDx0PHA8bDxocmVmOz47bDwvUmVlc3Rycy9SZWVzdHIvZGVmYXVsdC5hc3B4P3BhcnQ9UmVlc3RycyYxPWFjdGlvbnxTZWFyY2hAaWR8LTFAY29udHJhY3RpZHwtMUBhY3Rpb25iYWNrfE5vbmU7Pj47Oz47dDxwPGw8VmlzaWJsZTs%2BO2w8bzxmPjs%2BPjs7Pjt0PHA8bDxWaXNpYmxlOz47bDxvPGY%2BOz4%2BOzs%2BO3Q8cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Oz47dDxwPHA8bDxWaXNpYmxlOz47bDxvPGY%2BOz4%2BOz47Oz47dDxwPHA8bDxWaXNpYmxlOz47bDxvPHQ%2BOz4%2BOz47Oz47dDxwPGw8aHJlZjs%2BO2w8L1JlZXN0cnMvUmVlc3RyL2RlZmF1bHQuYXNweD9wYXJ0PVJlZXN0cnMmMT1hY3Rpb258Tm9uZUBpZHwtMUBjb250cmFjdGlkfC0xQGFjdGlvbmJhY2t8Tm9uZTs%2BPjs7Pjs%2BPjs%2BPjs%2BPjs%2BPjs%2BPjs%2BPjs%2BPjs%2BqJ73tlTnIvXMt%2FVIEKcRDg%2Bjw7I%3D&_ctl0%3A_ctl0%3AddeSource=Hand&_ctl0%3A_ctl0%3ASelectPaySystem%3AddPaySystem=3&_ctl0%3A_ctl0%3ASelectContractType%3AddContractType=1&_ctl0%3A_ctl0%3AtbeDescription=&_ctl0%3A_ctl0%3AbSave=%D1%EE%F5%F0%E0%ED%E8%F2%FC&_ctl0%3A_ctl0%3AhiddenContractType=
 
 
 
/////////// My Program //////////////////////////////////////////
POST /Reestrs/Reestr/default.aspx?part=Reestrs&1=action%7CCreate@id%7C-1@contractid%7C-1@actionback%7CNone HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: https://dealer.beeline.kz/Reestrs/Reestr/default.aspx?part=Reestrs&1=action|Create@id|-1@contractid|-1@actionback|View
Accept-Language: ru
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: mozilla/4.0 (compatible; msie 7.0; windows nt 6.0; slcc1; .net clr 2.0.50727; media center pc 5.0; .net clr 3.0.04506; infopath.2; .net clr 3.5.21022)
Cookie: ASP.NET_SessionId=wpldsc55runqv445zqmszk45; path=/
Host: dealer.beeline.kz
Content-Length: 1237
 
__VIEWSTATE=dDwxNjQxOTc1OTM2O3Q8O2w8aTwxPjs%252BO2w8dDw7bDxpPDQ%252BO2k8Nj47PjtsPHQ8cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Oz47dDw7bDxpPDA%252BOz47bDx0PDtsPGk8MD47aTwyPjs%252BO2w8dDxwPGw8VmlzaWJsZTs%252BO2w8bzxmPjs%252BPjs7Pjt0PDtsPGk8MD47PjtsPHQ8O2w8aTwwPjs%252BO2w8dDw7bDxpPDE%252BO2k8Mz47aTw1PjtpPDc%252BO2k8MzM%252BO2k8NDc%252BO2k8NTM%252BOz47bDx0PHA8bDxocmVmOz47bDwvUmVlc3Rycy9SZWVzdHIvZGVmYXVsdC5hc3B4P3BhcnQ9UmVlc3RycyYxPWFjdGlvbnxTZWFyY2hAaWR8LTFAY29udHJhY3RpZHwtMUBhY3Rpb25iYWNrfE5vbmU7Pj47Oz47dDxwPGw8VmlzaWJsZTs%252BO2w8bzxmPjs%252BPjs7Pjt0PHA8bDxWaXNpYmxlOz47bDxvPGY%252BOz4%252BOzs%252BO3Q8cDxsPFZpc2libGU7PjtsPG88Zj47Pj47Oz47dDxwPHA8bDxWaXNpYmxlOz47bDxvPGY%252BOz4%252BOz47Oz47dDxwPHA8bDxWaXNpYmxlOz47bDxvPHQ%252BOz4%252BOz47Oz47dDxwPGw8aHJlZjs%252BO2w8L1JlZXN0cnMvUmVlc3RyL2RlZmF1bHQuYXNweD9wYXJ0PVJlZXN0cnMmMT1hY3Rpb258Tm9uZUBpZHwtMUBjb250cmFjdGlkfC0xQGFjdGlvbmJhY2t8Tm9uZTs%252BPjs7Pjs%252BPjs%252BPjs%252BPjs%252BPjs%252BPjs%252BPjs%252BPjs%252BqJ73tlTnIvXMt%252FVIEKcRDg%252Bjw7I%253D&_ctl0:_ctl0:ddeSource=Hand&_ctl0:_ctl0:SelectPaySystem:ddPaySystem=3&_ctl0:_ctl0:SelectContractType:ddContractType=1&_ctl0:_ctl0:tbeDescription=&_ctl0:_ctl0:bSave=%25D1%25EE%25F5%25F0%25E0%25ED%25E8%25F2%25FC&_ctl0:_ctl0:hiddenContractType=

Open in new window

0
Comment
Question by:exceter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 24104660
So the problem is in getting the viewstate values in windows application ?
0
 
LVL 3

Author Comment

by:exceter
ID: 24107689
Possibly the problem is in getting the viewstate values, but not sure,
The problem I understand now is that query I built does not work. Even it is similar to query built in IE.
I cant figure out what the problem is
0
 
LVL 25

Expert Comment

by:apeter
ID: 24128003
Only when you post a form in IE you will have viewstate values but when you access a site through a Windows program you can't get view state since you have whole request and you are sole responsible for how to process it.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 3

Author Comment

by:exceter
ID: 24129248
Probably promblem is that...
After posting my promblem, I searched internet for VIEWSTATE, and decoded my VIEWSTATE with Base64-Decoder. There is nothing that I can see what may couse problem.
As I said earlier, my problem is that my POST does not work, even it is the same as IE POST.
I need help to make a working POST.
0
 
LVL 3

Author Comment

by:exceter
ID: 24129272
Hmm, so I do not have to look for VIEWSTATE?
I tried to POST my query without VIEWSTATE, I get the same error (just redirected to Error page)
0
 
LVL 25

Expert Comment

by:apeter
ID: 24130925
It is always Requesting a Page. We can't have POSTBACK's if call from Windows Application so we can't have any VIEWSTATE for the FORM.

One other way in windows application is, you can have web browser control in your windows Form and load your Page in that and interact.
0
 
LVL 3

Author Comment

by:exceter
ID: 24131384
The other way Sounds hopefully...
Could you show a bit of code for Web Browser control in WinForm and interact with that ?
0
 
LVL 25

Accepted Solution

by:
apeter earned 200 total points
ID: 24135003
0
 
LVL 3

Author Comment

by:exceter
ID: 24135258
tnx.
I will accept your answer.

P.S.
I have a combo box in my web-page, could you show how to auto-select value in it and press button?
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question