日期:2014-05-17 浏览次数:20504 次
/// <summary> /// Returns the responded HTTP headers of the given URL. /// </summary> /// <param name="Url">The adress.</param> /// <returns>List of headers</returns> public Dictionary<string, string> GetHTTPResponseHeaders(string Url) { Dictionary<string, string> HeaderList = new Dictionary<string, string>(); WebRequest WebRequestObject = HttpWebRequest.Create(Url); WebResponse ResponseObject = WebRequestObject.GetResponse(); foreach (string HeaderKey in ResponseObject.Headers) HeaderList.Add(HeaderKey, ResponseObject.Headers[HeaderKey]); ResponseObject.Close(); return HeaderList; }Snippet information Author: Jonas John License: Public domain Language: C# Created: 10/30/2007 Updated: 10/30/2007 Tags: http, network // Retrieve headers: Dictionary<string, string> Headers = GetHTTPResponseHeaders("http://www.jonasjohn.de/"); // And output them: foreach (string HeaderKey in Headers.Keys) Console.WriteLine("{0}: {1}", HeaderKey, Headers[HeaderKey]);
------解决方案--------------------
是http header节点中的值吗?比如:
//你看看你准备用那个 HtmlMeta HtmlLink HtmlGenericControl