- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using MSXML2;
- using System.Text.RegularExpressions;
- namespace EC
- {
- ///
- /// 远程文件抓取类
- ///
- public class GetRemoteObj
- {
- #region 构造与析构函数
- public GetRemoteObj()
- {
- //
- // TODO: 在此处添加构造函数逻辑
- //
- }
- ~GetRemoteObj()
- {
- Dispose();
- }
- #endregion
- #region IDisposable 成员
- public void Dispose()
- {
- GC.SuppressFinalize(this);
- }
- #endregion
- #region 日期随机函数
- /**********************************
- * 函数名称:DateRndName
- * 功能说明:日期随机函数
- * 参 数:ra:随机数
- * 调用示例:
- * GetRemoteObj o = new GetRemoteObj();
- * Random ra = new Random();
- * string s = o.DateRndName(ra);
- * Response.Write(s);
- * o.Dispose();
- * ********************************/
- ///
- /// 日期随机函数
- ///
- /// 随机数
- ///
- public string DateRndName(Random ra)
- {
- DateTime d = DateTime.Now;
- string s = null, y, m, dd, h, mm, ss;
- y = d.Year.ToString();
- m = d.Month.ToString();
- if (m.Length < 2) m = "0" + m;
- dd = d.Day.ToString();
- if (dd.Length < 2) dd = "0" + dd;
- h = d.Hour.ToString();
- if (h.Length < 2) h = "0" + h;
- mm = d.Minute.ToString();
- if (mm.Length < 2) mm = "0" + mm;
- ss = d.Second.ToString();
- if (ss.Length < 2) ss = "0" + ss;
- s += y + m + dd + h + mm + ss;
- s += ra.Next(100, 999).ToString();
- return s;
- }
- #endregion
- #region 取得文件后缀
- /**********************************
- * 函数名称:GetFileExtends
- * 功能说明:取得文件后缀
- * 参 数:filename:文件名称
- * 调用示例:
- * GetRemoteObj o = new GetRemoteObj();
- * string url = @"http://www.baidu.com/img/logo.gif";
- * string s = o.GetFileExtends(url);
- * Response.Write(s);
- * o.Dispose();
- * ********************************/