364,111 Members | 2134 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

WinHTTP post using VB.NET not work

kaushalmbhavsar
P: 4
I am working on one VB.NET application where I am using WinHttp.dll to post request on website.

First request is for Login Page and I have gone through all input types of that page and pass those variables and value pair in Send method of WinHTTPRequest but it is not works.

Let' me inform you that this login page has viewstate hidden input type, so should I have to pass it in post string (String for Send method argument)

list of Input types are

Name Value Type
Arg1 3 Hidden
_ViewState Some Value Hidden
UserID "Test" Text
PWD "Test" Password
SignIn "Sign In" Button (works as Submit)

I create post string as
First Attempt:
"Arg1=3&_ViewState&UserID=Test&PWD=Test&SignIn=Sig n IN"
Second Attempt: without _ViewState
"Arg1=3&UserID=Test&PWD=Test&SignIn=Sign IN"
Third Attempt:without _ViewState and SignIn
"Arg1=3&UserID=Test&PWD=Test"

Action page in Form tag is same aspx as login aspx page.

when I try like

WinHTTPRequestObj.Send(PostStr)

Response = WinHTTPRequestObj.ResponseText

Response will be contain same page as Login aspx page

So, can you please help me
Aug 12 '05 #1
Share this Question
Share on Google+
3 Replies


izzy
P: 12
I am working on one VB.NET application where I am using WinHttp.dll to post request on website.

First request is for Login Page and I have gone through all input types of that page and pass those variables and value pair in Send method of WinHTTPRequest but it is not works.

Let' me inform you that this login page has viewstate hidden input type, so should I have to pass it in post string (String for Send method argument)

list of Input types are

Name Value Type
Arg1 3 Hidden
_ViewState Some Value Hidden
UserID "Test" Text
PWD "Test" Password
SignIn "Sign In" Button (works as Submit)

I create post string as
First Attempt:
"Arg1=3&_ViewState&UserID=Test&PWD=Test&SignIn=Sig n IN"
Second Attempt: without _ViewState
"Arg1=3&UserID=Test&PWD=Test&SignIn=Sign IN"
Third Attempt:without _ViewState and SignIn
"Arg1=3&UserID=Test&PWD=Test"

Action page in Form tag is same aspx as login aspx page.

when I try like

WinHTTPRequestObj.Send(PostStr)

Response = WinHTTPRequestObj.ResponseText

Response will be contain same page as Login aspx page

So, can you please help me
WinHTTP is quite easy to use compared to other ways I have tried to POST data. I used your example as a starting point to try WinHTTP and found it did not work... Try adding the following line of code:

WinHTTPRequestObj.SetRequestHeader("content-type", "application/x-www-form-urlencoded")
Sep 3 '06 #2

izzy
P: 12
Let me know if it works!
Sep 3 '06 #3

kaushalmbhavsar
P: 4
Thank for reply.....

There was big joke with me.....Website which I was trying to make request using WinHTTP has been changed and now they dont have cookie....and any how problem was solved.
Sep 4 '06 #4

Post your reply

Help answer this question



Didn't find the answer to your Visual Basic .NET question?

You can also browse similar questions: Visual Basic .NET