HttpWebRequest 重定向问题
if ((webresponse.StatusCode == HttpStatusCode.Found) ||
(webresponse.StatusCode == HttpStatusCode.Redirect) ||
(webresponse.StatusCode == HttpStatusCode.Moved) ||
(webresponse.StatusCode == HttpStatusCode.MovedPermanently))
{
遇到这些状态的时候 那么读取重定向后的html
------解决方案--------------------不用管理会自动读取重定向后的html
------解决方案--------------------
HttpWebRequest request = HttpWebRequest.Create(Url) as HttpWebRequest;
request.AllowAutoRedirect = true;//获取或设置一个值,该值指示请求是否应跟随重定向响应。
request.MaximumAutomaticRedirections = 2;//获取或设置请求将跟随的重定向的最大数目。默认值为50