Results 1 to 14 of 14

Thread: WebClient.DownloadString(URL) returns Error 403 - Forbidden

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    369

    WebClient.DownloadString(URL) returns Error 403 - Forbidden

    From the browser, the page is accessible without any problems, but from my VB.NET code, I get an error.

    When I try to download the HTML of this page :
    https://www.gamestop.com/toys-collec.../11097180.html

    I get an Error - 403

    In my application I download a lot of other URL from other websites and I never had that problem before. I guess GameStop website has something different that could cause the problem.

    Anyone has an idea on how to solve my issue? I tried many solution, including adding headers like agent-user, etc but nothing worked.

    Thanks for any tips or help you can give me.

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Show the code please.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    The provided link returns 403 in the browser. Also the main site (gamestop.com/) returns 403. Tested with two 3 ISPs from 2 different countries.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    369

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Could not be simpler.


    Code:
            Try
    
                Dim strHTML As String = String.Empty
    
                System.Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls12
    
                Dim wcWebClient As New System.Net.WebClient
                'wcWebClient.Headers.Add("User-Agent: Mozilla/ 5.0(Windows NT 10.0; Win64; x64; rv: 79.0) Gecko/20100101 Firefox/79.0")
                'wcWebClient.Headers.Add("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
                'wcWebClient.Headers.Add("Accept-Language: en-US,en;q=0.5")
                'wcWebClient.Headers.Add("Accept-Encoding: gzip, deflate, br")
    
    
                strHTML = wcWebClient.DownloadString("myURLHere")
     
    
               ' I have other code here ... but the "DownloadString" above is the line that triggers the exception.
    
            Catch ex As Exception
                Return False
            End Try

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    369

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Quote Originally Posted by peterst View Post
    The provided link returns 403 in the browser. Also the main site (gamestop.com/) returns 403. Tested with two 3 ISPs from 2 different countries.
    What do you mean "link returns 403 in the browser" ? How do you test that? I access the page in 3 different browsers (IE, FF, Chome) without any problems.

  6. #6
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Multi-country checks - seems forbidden in many places:

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    I'm in Australia and if I click the link in post #1 the page displays fine for me in Edge.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    369

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Quote Originally Posted by peterst View Post
    Multi-country checks - seems forbidden in many places:
    Render Unavailable from California is weird. GameStop is in USA.
    Where are you located? I am in Canada and from here it works in all browser.

  9. #9
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    If gamestop has a help forum you should try there. It is their server generating the error.
    Last edited by dbasnett; Sep 21st, 2020 at 11:53 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  10. #10
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Quote Originally Posted by dbelley_office View Post
    Render Unavailable from California is weird. GameStop is in USA.
    Where are you located? I am in Canada and from here it works in all browser.
    I can't connect from major EU countries - all are forbidden. Anyway your code is OK and works with other sites. Seems there are some other checks some web-dev added to gamestop web site.

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    The posted link works for me, here in the US.
    My usual boring signature: Nothing

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    369

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Quote Originally Posted by Shaggy Hiker View Post
    The posted link works for me, here in the US.
    Are you able to execute my code for that link?

  13. #13
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    845

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    Quote Originally Posted by peterst View Post
    I can't connect from major EU countries - all are forbidden. Anyway your code is OK and works with other sites. Seems there are some other checks some web-dev added to gamestop web site.
    Yep, same for me, I get :

    Access Denied

    You don't have permission to access "http://www.gamestop.com/" on this server. Reference #18.9d711602.1600701220.2e547d4c
    I tried with a proxy and got the same result.
    The best friend of any programmer is a search engine
    "Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
    “They did not know it was impossible so they did it” (Mark Twain)

  14. #14
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: WebClient.DownloadString(URL) returns Error 403 - Forbidden

    I got Access Denied here in England

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