asp.net定时生成静态页面问题
是否需要在global里,做一个timer啊。
这是生成静态的方法
public void Dohtml(string Ourl, string Path)
我在global调用:
BLL.BLL hh = new BLL.BLL();
hh.Dohtml("http://localhost/default.aspx", System.Web.HttpContext.Current.Server.MapPath("./"));
但是不成功。在百度,google里搜索了无数次,仍为找到答案。请高手赐教。
-------------------------------------------------------------
我global里的代码是这样的:
protected void Application_Start(object sender, EventArgs e)
{
// 在应用程序启动时运行的代码
System.Timers.Timer myTimer = new System.Timers.Timer(1000 * 1 * 1);
myTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);//时间到了执行
myTimer.Interval = 1000 * 1 * 1;
myTimer.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件
myTimer.AutoReset = true;
// t.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
}
private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
{
try
{
BLL.BLL hh = new BLL.BLL();
hh.Dohtml("http://localhost/hengshuirc/default.aspx", System.Web.HttpContext.Current.Server.MapPath("./"));
}
catch { }
}