How to force WebRequest to send Authorization header during POST

前端 未结 3 1060
醉梦人生
醉梦人生 2020-12-09 08:54

When using WebRequest to send a POST, the Authorization header is not sent with the request even though I have manually set the header and set PreAuthenticate to true, eg:

3条回答
  •  轮回少年
    2020-12-09 09:09

    Try this, but there should be no space between the authorization headers.

    var authHeader = "OAuth  oauth_consumer_key=bFPD...";
    webRequest.Headers.Add("Authorization", authHeader);
    

提交回复
热议问题