Results 1 to 3 of 3

Thread: [2005] Expert with WebClient needed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    377

    [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:
    1. Dim web As New System.Net.WebClient()
    2. Dim strPostData As String
    3.  
    4.         strPostData = "login_form_submit=1&admin=" + txtlogin.Text + "&password=" + txtPass.Text
    5.         web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
    6.         web.Headers.Add("Referer", "http://www.domain.com")
    7.  
    8.         Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes(strPostData)
    9.         web.UploadData("http://www.domain.com/index.html", "POST", d)
    10.  
    11.         [B]'Code Needed: Wait till execution of (login) is complete.
    12.         'Code Needed: Goto and Open this page [url]http://www.domain.com/admin/updates.html[/url]
    13.         'Code Needed: Wait till execution of webpage is complete.[/B]

    this is what i use to do in vb6

    VB Code:
    1. Dim nUrl, strPostData As String
    2.         strPostData = "login_form_submit=1&admin=" + txtlogin.Text + "&password=" + txtPass.Text
    3. Inet.Execute "http://www.domain.com/index.html", "POST", _
    4. strPostData, "Content-Type: application/x-www-form-urlencoded" & vbCrLf _
    5. "Referer: http://www.domain.com" & vbCrLf
    6.  
    7.     Do
    8.         On Error GoTo Err:
    9.         DoEvents
    10.     Loop Until Inet.StillExecuting = False
    11.  
    12. nUrl = "http://admin.domain.com/?OPERATION=1&ADMIN="
    13.  
    14. Inet.OpenURL nUrl + txtSN.Text + "&SUBJECT=" + txtSub.Text _
    15. + "&MESSAGE=" + txtmsg.Text + "&POST.x=46&POST.y=5"
    16.  
    17.     Do
    18.         On Error GoTo Err:
    19.         DoEvents
    20.     Loop Until Inet.StillExecuting = False
    21.  
    22. Msgbox "Done!"

  2. #2
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    377

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width