有没有办法从.net上的Web服务调用获取响应头?
答案 0 :(得分:2)
从WebMethod(Web服务方法)
中编写以下代码您可以使用for循环遍历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
}