[2005] Expert with WebClient needed
I'm in the process of converting over old coding to vb2005. The coding should login to the site, wait till execution is complete, then post to the post link page. I have some vb2005 coding below and under that my old working vb6 coding. so you can see from vb6 what i'm trying to do in vb2005
VB Code:
Dim web As New System.Net.WebClient()
Dim strPostData As String
strPostData = "login_form_submit=1&admin=" + txtlogin.Text + "&password=" + txtPass.Text
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
web.Headers.Add("Referer", "http://www.domain.com")
Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes(strPostData)
web.UploadData("http://www.domain.com/index.html", "POST", d)
[B]'Code Needed: Wait till execution of (login) is complete.
'Code Needed: Goto and Open this page [url]http://www.domain.com/admin/updates.html[/url]
'Code Needed: Wait till execution of webpage is complete.[/B]
this is what i use to do in vb6
VB Code:
Dim nUrl, strPostData As String
strPostData = "login_form_submit=1&admin=" + txtlogin.Text + "&password=" + txtPass.Text
Inet.Execute "http://www.domain.com/index.html", "POST", _
strPostData, "Content-Type: application/x-www-form-urlencoded" & vbCrLf _
"Referer: http://www.domain.com" & vbCrLf
Do
On Error GoTo Err:
DoEvents
Loop Until Inet.StillExecuting = False
nUrl = "http://admin.domain.com/?OPERATION=1&ADMIN="
Inet.OpenURL nUrl + txtSN.Text + "&SUBJECT=" + txtSub.Text _
+ "&MESSAGE=" + txtmsg.Text + "&POST.x=46&POST.y=5"
Do
On Error GoTo Err:
DoEvents
Loop Until Inet.StillExecuting = False
Msgbox "Done!"
Re: [2005] Expert with WebClient needed
Well, I'm not a full pro at WebClients but I can get you to open a url in the default web browser.
Code =
System.Diagnostics.Process.Start("THE URL GOES HERE")
Put this code in wherever it is needed and it should do the trick. I didn't understand what you meant by the web browser "waiting". I have a URL link that might help you: http://blogs.msdn.com/vbfaq/.
Good luck because I hope that helps.
Re: [2005] Expert with WebClient needed
well that code just load the link behind the scenes like how the inet.control inet.OpenURL works? i don't want to load and actual browser window