手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >dz asp.net论坛中函数--根据Url获得源文件内容
dz asp.net论坛中函数--根据Url获得源文件内容
摘要:需要引入命名空间:复制代码代码如下:usingSystem.Net;usingSystem.IO;函数内容:复制代码代码如下://////根...

需要引入命名空间:

复制代码 代码如下:

using System.Net;

using System.IO;

函数内容:

复制代码 代码如下:

/// <summary>

/// 根据Url获得源文件内容

/// </summary>

/// <param name="url">合法的Url地址</param>

/// <returns></returns>

public static string GetSourceTextByUrl(string url)

{

WebRequest request = WebRequest.Create(url);

request.Timeout = 20000;//20秒超时

WebResponse response = request.GetResponse();

Stream resStream = response.GetResponseStream();

StreamReader sr = new StreamReader(resStream);

return sr.ReadToEnd();

}

【dz asp.net论坛中函数--根据Url获得源文件内容】相关文章:

asp.net小孔子cms中的数据添加修改

asp.net下大文件上传知识整理

asp.net中导出excel数据的方法汇总

asp.net下url传递中文的解决方案

asp.net中包含文件的代码及使用方法

asp.net 备份和恢复数据库的方法

asp.net生成高质量缩略图通用函数(c#代码),支持多种生成方式

asp.net 上传大文件解决方案

asp.net Xml绑定到数据控件的具体实现

asp.net 多字段模糊查询代码

精品推荐
分类导航