TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shefali Lahariya
NA
257
155.4k
Getting response "System.Net.HttpStatusCode.Unauthorized"
Nov 22 2017 6:08 AM
Hi,
i am using below code i am getting response " Getting response "
System.Net.HttpStatusCode.Unauthorized
"" but its working fine on postman so how to resolve this error.
public static async Task<string>getDataFromService(string wInputData, string Uri)
{
string json = string.Empty;
using (HttpClient client = new HttpClient())
{
//client.DefaultRequestHeaders.Add("API_KEY", "X-some-key");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Authorization","Basic MzUzYjMwMmM0NDU3NGY1NjUwNDU2ODdlNTM0ZTdkNmE6Mjg2OTI0Njk3ZTYxNWE2NzJhNjQ2YTQ5MzU0NTY0NmM=");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpContent content = new StringContent(wInputData);
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
var response =await client.PostAsync("http://13.228.72.152:8080/JioMeet/oauth/token",content);
if (response != null)
{
return response.ToString();
//return response.StatusCode;
}
else
{
return "no data";
// return System.Net.HttpStatusCode.BadRequest;
}
}
}
Reply
Answers (
1
)
Enable button on only text file select
why use IQueryable or IEnumerable