Get response headers from a WebService call?

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

+1


source to share


1 answer


Enter the following code from WebMethod (Web Service Method)

You can use a for loop to iterate over all key 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
}

      

+2


source







All Articles