By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

WinHTTP post using VB.NET not work

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


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

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

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

Sign in to post your reply or Sign up for a free account.