Reputation: 4527
Is there a way to get the responde headers from a web service call on .net?
Upvotes: 2
Views: 2380
Reputation: 16204
Write the following code from inside of the WebMethod (Web Service Method)
You may use a for loop to iterate through all the keys value pairs in the Header
int Count = HttpContext.Current.Request.Headers.Count;
for (int i = 0; i < Count; i++)
{
string key = HttpContext.Current.Request.Headers.GetKey(i);
string keyValue = HttpContext.Current.Request.Headers.Get(i);
//Do something
}
Upvotes: 3