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;
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;
相关文章推荐
- asp.net 网站所有请求跳转到同一个页面
- 如何使用 asp.net 4.0 新特性 路由功能 有助于seo优化 给一个 asp.net web项目(网站项目) 增加路由功能 ,继承,给根据路由生成的url的结尾,增加一个有利于seo优化的斜杠 /,跳转到一个路由生成的url页面
- 教你如何在WINDOWS Server2003上部署一个Asp.Net的网站
- ASP.NET MVC中如何在当前页面上弹出另外一个页面
- 每次我们请求一个asp.net页面时,我们都经历着同样的过程
- 在ASP.NET 中如何返回到上一个页面
- 如何发布一个ASP.NET网站
- 如何做一个基于ASP.NET MVC 网站(二)
- IIS如何处理Asp.net请求和Asp.net页面生命周期方法
- 页面中包含同一个asp.net控件多次,如何产生不同的javascript方法名
- [原创] ASP.NET 中如何弹出提示窗口然后导向另外一个页面
- 如何整合AD验证和ASP.NET表单验证为一个网站
- 要用asp.net和sql server做一个购物网站,如何实现购物车功能啊?
- 如何使用谷歌的自定义搜索引擎来搜寻一个ASP.NET网站
- VS中一个解决方案有多个Web网站.如何不启动全部asp.net development server(WEB服务器)
- ASP.NET中如何阻止后退按钮回到前一个页面
- 【ASP.NET】登陆成功后如何跳转到上一个页面
- 如何使用谷歌的自定义搜索引擎来搜寻一个ASP.NET网站
- 从无到有,教你如何在Server2003上部署一个Asp.Net的网站(转载)
- 如何发布一个ASP.NET网站