Receiving The remote server returned an error: (403) Forbidden message

后端 未结 3 527
生来不讨喜
生来不讨喜 2021-01-19 03:08

I am receiving \"The remote server returned an error: (403) Forbidden\" error message on the block of code below. Specifically this line is failing: var response =

相关标签:
3条回答
  • 2021-01-19 03:46

    Try checking on both production and dev iis the authentication methods for the application (iis manager -> click on the website->features view ->authentication).

    Sounds like on the dev iis you have anonymous authentication enabled, and on production iis not. If you will not have anonymous auth enabled on production, you will probably need to set the request.Credentials as you can see above.

    0 讨论(0)
  • 2021-01-19 03:51

    Have you tried setting the Credentials object on the request with proper authorization for the server you are trying to access? See System.Net.NetworkCredential.

    0 讨论(0)
  • 2021-01-19 03:57

    You might need to specify credentials

    request.Credentials = CredentialCache.DefaultCredentials;
    

    or you if you need to pass specific credentials pass:

    request.Credentials = new NetworkCredentials("user", "password");
    

    More information about NetworkdCredential Class

    0 讨论(0)
提交回复
热议问题