tags:

views:

113

answers:

0

i am making a request to a 3rd party RESTful service using M$'s HttpClient. it works flawlessly (and is very easy to implement) except for this one instance. here is a breakdown from the provider as to what is occurring during the error: "The way the POST to the group resource works is that when it completes, it does a HTTP 302 redirect to the group instance resource. What appears to be happening is that your HTTP Client is sending the proper authentication information to the POST, which creates the group resource, but when it handles the GET for the HTTP 302 request, it is not sending the right credentials and is getting a 401 response. Can you check your client library and make sure its sending HTTP auth parameters properly on redirects?"

here is my POST code:

HttpClient http = new HttpClient(BASE_URL);
http.TransportSettings.Credentials = new NetworkCredential(ACCOUNT_SID, ACCOUNT_TOKEN);
HttpResponseMessage httpResponse = http.Post(groupUri, "application/xml", HttpContent.Create(xml.ToString()));
result = httpResponse.Content.ReadAsString();

which brings me to my question, how do i get the authentication parameters to send on this GET redirect using HttpClient?