REST API knowledge exchange
jerny_huang
Novice
Posts: 8 Liked: never
Joined: Aug 06, 2014 8:11 am
Full Name: Jerny Huang
Contact:
Post
by jerny_huang » Aug 06, 2014 9:34 am
this post
I call sessionMgr api with C#, but failed. I need to help.
Code: Select all
public static void SetBasicAuthHeader(String userName, String userPassword)
{
var req = WebRequest.Create("http://10.17.68.170:9399/api/sessionMngr/");
string authInfo = userName + ":" + userPassword;
authInfo = Convert.ToBase64String(Encoding.ASCII.GetBytes(authInfo));
req.Headers["Authorization"] = "Basic " + authInfo;
req.GetResponse();
}
veremin
Product Manager
Posts: 20675 Liked: 2380 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:
Post
by veremin » Aug 06, 2014 10:29 am
this post
And what errors you had? I'm not that familiar with C#, but shouldn't a web request be declared as a POST one? Something like webRequest.Method = "POST"? Thanks.
Users browsing this forum: No registered users and 12 guests