0
我试图使用C#连接到REST API。 我能够成功做一些GET请求,但POST不断给我401认证错误。能够获得身份验证但不通过POST身份验证
我已经取得了进展,并下载提琴手,这就是我的要求是这样的:
GET(工程)
请求头
GET https: //hello.myurl.com/api HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Accept: application/xml
Authorization: Basic ***************************************************************************************************
Host: hello.myurl.com
-
POST(隐而不宣” t工作)
请求标头
POST https: //hello.myurl.com/api HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Accept: application/xml
Authorization: Basic ***************************************************************************************************
Host: hello.myurl.com
Content-Length: 12
请求体
status=hello
(*同样在使用两种
String authinfo = "username:password";
Convert.ToBase64String(Encoding.ASCII.GetBytes(authInfo));
任何想法,为什么?
你写了webservice还是别人?它看起来像你说的一样,如果有一些方法认证他们 – 2012-01-06 03:53:54
但我发送身份验证的详细信息。 – soldieraman 2012-01-06 06:06:37