Results 1 to 6 of 6

Thread: httpwebrequest

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    113

    httpwebrequest

    Hi,
    I am trying to use httpwebrequest but I keep getting a message that says "Create is not a member of webrequest" every time I try and use the msn example code.

    vb Code:
    1. Dim myReq As HttpWebRequest = WebRequest.Create("http://www.contoso.com/")

  2. #2
    Lively Member
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    115

    Re: httpwebrequest

    Have you added
    Code:
    Imports System.Net
    at the top of your code, before the Public Class Form statement? I think this is needed for creating web requests.
    Regards
    Colin

    If my comments helped please remember to add to my reputation using Rate This Post.

    If your problem has been resolved please mark the thread resolved using the "Mark Thread Resolved" link in thread tools.

    CodeBank Submissions: 1) WebBrowser - Delete cookies etc 2) Import My.Settings from previous build version

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    113

    Re: httpwebrequest

    Quote Originally Posted by wearmc View Post
    Have you added
    Code:
    Imports System.Net
    at the top of your code, before the Public Class Form statement? I think this is needed for creating web requests.
    HI Colin,
    Imports System.Net was already there, however I found the error.
    When I changed it to
    vb Code:
    1. Dim Request As HttpWebRequest = Net.WebRequest.Create(url)

    All was ok.

  4. #4
    Lively Member
    Join Date
    Jan 2010
    Location
    United Kingdom
    Posts
    115

    Re: httpwebrequest

    Glad to hear you found a solution. Good Work.
    Regards
    Colin

    If my comments helped please remember to add to my reputation using Rate This Post.

    If your problem has been resolved please mark the thread resolved using the "Mark Thread Resolved" link in thread tools.

    CodeBank Submissions: 1) WebBrowser - Delete cookies etc 2) Import My.Settings from previous build version

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

    Re: httpwebrequest

    It sounds like you had a name clash. I'm guessing that either your project or the class that that code is in was called WebRequest, so the code interpreted your reference as that. By qualifying the name you changed the meaning of the code and it referred to the correct type.
    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

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    113

    Re: httpwebrequest

    Quote Originally Posted by jmcilhinney View Post
    It sounds like you had a name clash. I'm guessing that either your project or the class that that code is in was called WebRequest, so the code interpreted your reference as that. By qualifying the name you changed the meaning of the code and it referred to the correct type.
    Aaah!
    Thats what is was, my project is called WebRequest.

    Thanks jmcilhinney

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