日期:2014-05-17 浏览次数:21125 次
HttpWebRequest request = null;
request = (HttpWebRequest)WebRequest.Create(url);
request.AllowAutoRedirect = true;
request.Timeout = 20000;
request.MaximumAutomaticRedirections = 10;
request.Method = "GET";
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36";
request.Accept = " text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
request.Host = "略过";
request.Referer = "略过";
//加载个人Cookie
request.Headers.Add("Cookie", "略过");
//不保持连接
request.KeepAlive = false;
// 获取对应HTTP请求的响应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string redirectUrl = response.Headers["Location"];??????//这里就是跳转地址了