您的位置:首页 > 编程语言 > ASP

asp.net 中如何请求一个其它网站的页面

2010-07-21 16:55 288 查看
HttpWebRequest web = (HttpWebRequest)HttpWebRequest.Create(url);
web.ServicePoint.Expect100Continue = false;
web.AllowAutoRedirect = false;
web.ContentType = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
web.Accept = this.Request.AcceptTypes.ToString();
web.Method = "GET";
web.UserAgent = this.Request.UserAgent;

HttpWebResponse res = (HttpWebResponse)web.GetResponse();
string html = new StreamReader(res.GetResponseStream(), Encoding.UTF8).ReadToEnd();
return html;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐