Results 1 to 4 of 4

Thread: Connecting to a website

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    22

    Connecting to a website

    I'm looking to have a program connect to a specific website, enter data, and then return something but without using the WebBrowser.

    For instance, I want it to:

    Connect to a website
    Login to the website
    Return if it logged me in or some error
    etc

    I'm kindof new to VB so I'm not sure how to go about this so any help would be appreciated, thank you.

    Edit: I read up a little bit about using WebClient and I understand a small bit of it but not much
    Last edited by Sai-B0t; Feb 10th, 2012 at 02:42 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Connecting to a website

    The WebClient is the simplest option. It has methods to download data in three ways: as binary data (Byte array), as text (String) or to a file. It also has corresponding methods to upload data in the same three ways. There's a fourth upload method for values, which basically corresponds to form fields in a web page. It sounds like that is they the way to go for you so that's what you should research first.

    If you need more fine-grained control than the WebClient offers then you can use an HttpWebRequest and HttpWebResponse. You can also use the two in conjunction via the GetWebRequest and GetWebResponse methods of the WebClient.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    22

    Re: Connecting to a website

    Yeah, thank you that is what i'm looking for, but all of the information i've found while researching was on that topic, but unrelated of what i'm trying to do and I have no idea of how to do it.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Connecting to a website

    If you want to perform multiple actions within a session then you will need to look at the HttpWebRequest and HttpWebResponse classes, which are able to use the same cookies for multiple transactions. That way, when you login and get an authentication cookie, you can use that cookie with subsequent requests. Look for examples that use the HttpWebRequest.CookieContainer property and the HttpWebResponse.Cookies property.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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