我的目的是:每分钟,后台自动激活(这个地址是发短信的地址,要定时触发)一个地址。我在Global.asax中填加void Application_Start(object sender, EventArgs e) 
    {        System.Timers.Timer myTimer = new System.Timers.Timer();
        myTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
        myTimer.Interval = 60000;
        myTimer.Enabled = true; }
    private  void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
    {
      Response.Redirect("URL");    //url是我要激活的地址
    }
  却怎么也达不到要求,请各位帮我看看哪里错了。

解决方案 »

  1.   

    怎么打不到,是不执行还是怎样,你还可以考虑用javascript的定时
      

  2.   

    漏洞百出,首先,你得搞清楚你请求的生命周期,你的OnTimedEvent事件是一个服务端事件,你的Response是指向httpcontext中的httpResponse,请求的生命周期已经结束,你拿什么执行Redirect
      

  3.   

    在前端用JS setTimeOut,跳转URL在后台你Response 给谁啊?
      

  4.   

    我刚小学毕业请各位大虾,能告诉我具体的方法么?timer定时任务还是第1次做。请多多帮忙,谢谢各位!
      

  5.   

    漏洞百出,首先,你得搞清楚你请求的生命周期,你的OnTimedEvent事件是一个服务端事件,你的Response是指向httpcontext中的httpResponse,请求的生命周期已经结束,你拿什么执行Redirect 
    请问这个的意思是,服务端事件是不能用Response.Redirect("URL")么?那服务端事件要怎么实现页面跳转呢?