HttpClient in .net issues 2 requests when providing username and password in NetworkCredentials

前端 未结 4 1558
误落风尘
误落风尘 2021-01-18 08:00

When using the HttpClient in .net 4.5 to do basic authentication I\'m finding that it\'s issuing 2 requests.

The first fails with a HTTP/1.1 401 Unauthorized and the

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 08:24

    The best to avoid the second call is to create and set Authorization header manually: https://stackoverflow.com/a/4346843/1143824

提交回复
热议问题