c# 获取远程URL页面的内容
2010-06-28 00:18
381 查看
using System; using System.Net; using System.IO; using System.Text; using System.Net.Sockets; namespace WebApplication1 { /// <summary> ///getPage 的摘要说明 /// </summary> public class getPage { /// <summary> /// 获取页面类容 /// </summary> /// <param name="strUrl"></param> /// <returns></returns> public static string GetHtml( string strUrl ) { WebRequest request = WebRequest.Create( strUrl ); //request.Credentials = new System.Net.NetworkCredential( "用户名", "密码", "域" ); //request.Proxy = new WebProxy( "192.168.72.254:8080", true, new string[] { }, request.Credentials ); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader( response.GetResponseStream(), Encoding.UTF8 ); string str = reader.ReadToEnd(); reader.Close(); reader.Dispose(); response.Close(); return str; } } }
相关文章推荐
- c# 获取远程URL页面的内容
- c# 远程获取网页内容,防止乱码,页面获取不全
- C# 通过url地址获取页面内容
- C# 根据Url获取页面所有内容
- C#获取当前页面的url
- .net实现远程获取其他网站页面内容
- (转)用.net实现远程获取其他网站页面内容!(核心代码分析)
- C#获取远程网页中的所有链接URL(网络蜘蛛实现原理)
- C#访问URL并获取文件内容(Web)
- c# 通过访问URL,获取并解析远程服务端返回的复杂Json数据
- c#获取当前页面的url信息
- C#获取页面URL地址
- 获取一个url的页面的内容
- C# POST数据到指定url并返回结果页面内容
- 使用jQuery.get(url,[data],[callback])不能获取返回的页面XML内容
- 用asp.net实现远程获取其他网站页面指定内容
- 获取远程的字符串(请求一个URL, 返回这个请求页面的页面数据)
- c#远程获取网页内容
- 用.net实现远程获取其他网站页面内容!(核心代码分析)
- C#获取远程网页中的所有链接URL(网络蜘蛛实现原理)