|
-
Sep 17th, 2000, 05:25 PM
#1
Thread Starter
Hyperactive Member
How would I go about posting a form using the POST method within my own browser.
For instance, if I wanted to log into my web based email account thru my own program.
Also, would using my own web browser send my cookies along with the form posting? I'd like it to send the appropriate cookies.
VB.NET 2005 Express with .Net 2.0
C# 2010 .Net 4.0
-
Sep 17th, 2000, 05:49 PM
#2
Thread Starter
Hyperactive Member
I used the wizard to create a web browser, and noticed this.
Code:
brwWebBrowser.Navigate cboAddress.Text
Now I also noticed that one of the options is "Post Data" I think this is what I'm looking for in order to be able to post data to the web server. Can anyone tell me how to enter the data?
For instance if the form had a username and a password and the username were "Chris H" and the password were "pass" how would I add it onto
Code:
brwWebBrowser.Navigate cboAddress.Text
*If the webpage were using the GET method life would be so much easier*
-
Sep 17th, 2000, 05:53 PM
#3
Hyperactive Member
If you dont need the web browser you can use the Internet Transfer control to post data to the web server.
"People who think they know everything are a great annoyance to those of us who do."
-
Sep 17th, 2000, 06:07 PM
#4
Thread Starter
Hyperactive Member
sweet, the web browser was just a throw in.
what is the code for the inet control to do that?
Can I find the info at MSDN?
-
Sep 17th, 2000, 06:15 PM
#5
Hyperactive Member
This article says its about POST but its really about get.
http://www.vbsquare.com/internet/cgi/
I can try whipping up a sample POST program for you but its gonna have to wait until after my chemistry is done
"People who think they know everything are a great annoyance to those of us who do."
-
Sep 17th, 2000, 10:26 PM
#6
Hyperactive Member
Ok the Internet Transfer control doesnt seem to cut it, but we can emulate a post using the Winsock control. I hacked the following little bit of code together just now so sorry if its a bit rough (its late).
Code:
Option Explicit
Private Sub Form_Load()
Winsock1.Connect "sajendra.dhs.org", 80
End Sub
Private Sub Winsock1_Connect()
Winsock1.SendData "GET /saj/classes/xml/CGIPost/test.asp HTTP/1.0" & vbNewLine
Winsock1.SendData "Content-type: application/x-www-form-urlencoded" & vbNewLine
Dim myData As String
myData = "name=myname&password=mypassword"
Winsock1.SendData "Content-length: " & Len(myData)
Winsock1.SendData vbNewLine
Winsock1.SendData myData
Winsock1.SendData vbNewLine
Winsock1.SendData vbNewLine
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
If bytesTotal = 0 Then Exit Sub
Dim received As String
Winsock1.GetData received, 0, bytesTotal
MsgBox received
End Sub
"People who think they know everything are a great annoyance to those of us who do."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|