RestSharp - Authorization Header not coming across to WCF REST service

前端 未结 3 768
攒了一身酷
攒了一身酷 2021-02-04 01:30

I am trying to call a locally hosted WCF REST service over HTTPS with basic auth.

This works and the Authorization header comes thru just fine and all is happy:

3条回答
  •  感动是毒
    2021-02-04 01:55

    instead of adding the header 'manually' do the following:

    var client = new RestSharp.RestClient("https://localhost/MyService/MyService.svc/");
    client.Authenticator = new HttpBasicAuthenticator("UserA", "123");
    

提交回复
热议问题