asp.net采集函数(采集、分析、替换、入库一体)

 

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Web;
  5. using System.Web.Security;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using System.Web.UI.WebControls.WebParts;
  9. using System.Web.UI.HtmlControls;
  10. using MSXML2;
  11. using System.Text.RegularExpressions;
  12. namespace EC
  13. {
  14.     /// 
  15.     /// 远程文件抓取类
  16.     /// 
  17.     public class GetRemoteObj
  18.     {
  19.         #region 构造与析构函数
  20.         public GetRemoteObj()
  21.         {
  22.             //
  23.             // TODO: 在此处添加构造函数逻辑
  24.             //
  25.         }
  26.         ~GetRemoteObj()
  27.         {
  28.             Dispose();
  29.         }
  30.         #endregion
  31.         #region IDisposable 成员
  32.         public void Dispose()
  33.         {
  34.             GC.SuppressFinalize(this);
  35.         }
  36.         #endregion
  37.         #region 日期随机函数
  38.         /**********************************
  39.          * 函数名称:DateRndName
  40.          * 功能说明:日期随机函数
  41.          * 参    数:ra:随机数
  42.          * 调用示例:
  43.          *          GetRemoteObj o = new GetRemoteObj();
  44.          *          Random ra = new Random();
  45.          *          string s = o.DateRndName(ra);
  46.          *          Response.Write(s);
  47.          *          o.Dispose();
  48.          * ********************************/
  49.         /// 
  50.         /// 日期随机函数
  51.         /// 
  52.         /// 随机数
  53.         /// 
  54.         public string DateRndName(Random ra)
  55.         {
  56.             DateTime d = DateTime.Now;
  57.             string s = null, y, m, dd, h, mm, ss;
  58.             y = d.Year.ToString();
  59.             m = d.Month.ToString();
  60.             if (m.Length < 2) m = "0" + m;
  61.             dd = d.Day.ToString();
  62.             if (dd.Length < 2) dd = "0" + dd;
  63.             h = d.Hour.ToString();
  64.             if (h.Length < 2) h = "0" + h;
  65.             mm = d.Minute.ToString();
  66.             if (mm.Length < 2) mm = "0" + mm;
  67.             ss = d.Second.ToString();
  68.             if (ss.Length < 2) ss = "0" + ss;
  69.             s += y + m + dd + h + mm + ss;
  70.             s += ra.Next(100, 999).ToString();
  71.             return s;
  72.         }
  73.         #endregion
  74.         #region 取得文件后缀
  75.         /**********************************
  76.          * 函数名称:GetFileExtends
  77.          * 功能说明:取得文件后缀
  78.          * 参    数:filename:文件名称
  79.          * 调用示例:
  80.          *          GetRemoteObj o = new GetRemoteObj();
  81.          *          string url = @"http://www.baidu.com/img/logo.gif";
  82.          *          string s = o.GetFileExtends(url);
  83.          *          Response.Write(s);
  84.          *          o.Dispose();
  85.          * ********************************/
  86.         
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值