the request failed with http status 401 unauthorized
Solution
System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential();
myCredential.UserName = "
myCredential.Password = "
The above code has been changed as
myCredential = new NetworkCredential("username", "password", "domain");
Started working