0
之间的区别。当我有一个HttpWebResponse对象,有访问响应头有两种方式:HttpWebResponse页眉和GetResponseHeader
string dateHeader = webResponse.Headers["Date"];
string dateHeader = webResponse.GetResponseHeader("Date");
他们都返回相同的值,那么,为什么有两种方式获得头信息? 望着.NET人士透露,如果发现执行情况无论是在HttpWebReponse:
// retreives response header object
/// <devdoc>
/// <para>
/// Gets
/// the headers associated with this response from the server.
/// </para>
/// </devdoc>
public override WebHeaderCollection Headers {
get {
CheckDisposed();
return m_HttpResponseHeaders;
}
}
/// <devdoc>
/// <para>
/// Gets a specified header value returned with the response.
/// </para>
/// </devdoc>
public string GetResponseHeader(string headerName) {
CheckDisposed();
string headerValue = m_HttpResponseHeaders[headerName];
return ((headerValue==null) ? String.Empty : headerValue);
}
我唯一能看到的是,与该标题属性,我可以通过所有availiable头枚举。有任何想法吗?
谢谢!