Results 1 to 4 of 4

Thread: Going to a URL with a VB.NET WebBrowser gives a different result than Firefox?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2010
    Posts
    8

    Going to a URL with a VB.NET WebBrowser gives a different result than Firefox?

    My problem's simple. I'm attempting to load a login page for a site in a VB.NET WebBrowser control.

    When I go to the site in Firefox, I see the site like normal.
    When I go to the site with my VB.NET WebBrowser control, I get a 401: Unauthorized error.

    What could cause the WebBrowser to load something differently than Firefox? Is there any way around this?

  2. #2
    Hyperactive Member
    Join Date
    Dec 2006
    Posts
    293

    Re: Going to a URL with a VB.NET WebBrowser gives a different result than Firefox?

    Quote Originally Posted by joyner.cn View Post
    My problem's simple. I'm attempting to load a login page for a site in a VB.NET WebBrowser control.

    When I go to the site in Firefox, I see the site like normal.
    When I go to the site with my VB.NET WebBrowser control, I get a 401: Unauthorized error.

    What could cause the WebBrowser to load something differently than Firefox? Is there any way around this?
    What is the url you are trying to navigate?

  3. #3
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Going to a URL with a VB.NET WebBrowser gives a different result than Firefox?

    Maybe the website checks the browser type/agent...
    To try this, use the Navigate method with extra parameters, for example:
    vb.net Code:
    1. WebBrowser1.Navigate("URL", "TargetFrame", null, "User-Agent: CustomUserAgent\r\n")

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2010
    Posts
    8

    Re: Going to a URL with a VB.NET WebBrowser gives a different result than Firefox?

    Oh, interesting. That latter solution helped me find the problem, it was just a dumb issue on my part.

    Basically, my program checks to see if I'm already logged in by checking to see if my username appears on the homepage. If it doesn't, it logs in; if it does, it goes on to the next page. That 'next page' is where I was getting a 401 error, but the problem was that I wasn't actually logged in -- but on the front page of the site, an article by me was featured, so my username still appeared.

    Silly me. Thanks for that tip, that's really useful.

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