Hi All,
I am making a web request in my plugin ,it is working fine . But it is making two web request, I've looked on server trace I found two web request one with status code 200 and other one with status code 401.
Does anybody have idea why this is making two calls and how can I resolve this? I want to make only one call with status 200.
I am using below code to make a web request. My plugin is registered on Create of any entity as Post operation, and it is asynchronous.
NetworkCredential nwCred=new NetworkCredential();
nwCred.UserName = Username;
nwCred.Domain = Domain;
nwCred.Password = Password;
WebRequest request = WebRequest.Create(uri);
request.Method = "POST";
request.ContentType = "application/json";
request.Credentials = nwCred;
using (Stream stream = request.GetRequestStream())
{
using (StreamWriter writer = new StreamWriter(stream))
{
writer.WriteLine(body);
}
}
Thanks ,