views:

288

answers:

1

Is there a way to get the responde headers from a web service call on .net?

+1  A: 

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
}
Binoj Antony