The remote server returned an error: (403) Forbidden

后端 未结 10 1428
半阙折子戏
半阙折子戏 2020-12-15 03:16

I\'ve written an app that has worked fine for months, in the last few days I\'ve been getting the error below on the installed version only.

If I run the source code

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-15 04:16

    In my case I had to add both 'user agent' and 'default credentials = True'. I know this is pretty old, still wanted to share. Hope this helps. Below code is in powershell, but it should help others who are using c#.

    [System.Net.HttpWebRequest] $req = [System.Net.HttpWebRequest]::Create($uri)
    $req.UserAgent = "BlackHole"
    $req.UseDefaultCredentials = $true
    

提交回复
热议问题