计时器滴答应发生与页面加载无关 [英] timer tick should occur irrespective of page load

查看:96
本文介绍了计时器滴答应发生与页面加载无关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只有很少的aspx页连接到母版页.
现在,在每个内容页面上,我正在运行asp计时器,当计时器完成时,我已对tick事件编写了一些操作.现在的问题是,当发生特定页面的页面加载时,只有且然后才触发滴答事件.在这里,无论页面加载事件如何,我都希望各个页面的所有计时器执行其操作,这意味着我是否重定向到特定页面.
坦率地说,无论页面加载方式如何而无需加载特定页面,都应进行数据库更新.请尽早帮助我解决这个问题.

i have few aspx pages connected to master page.
on each content page i am running asp timer now when timer finishes i have written some action on the tick event . Now the problem is that when the page load of perticular page occurs then and only then tick event fires . here i want all the timers of respective pages to perform their action irrespective of their page load event means whether i redirect to perticular page or not.
to be frank database updation should occur irrespective of page load means without loading perticular page. pls help me out with this as early as possible

推荐答案

您有不同的处理方式,但这取决于您的要求.

其中之一,Tadit已建议使用Global.asax应用程序事件来进行定期数据库更新.但是可以浏览有关所涉及风险的链接

http://haacked .com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx/ [ http://msdn.microsoft.com/en-us/magazine/cc163821.aspx [ ^ ]

希望这对您有帮助...
You have different options to handle it but it depends on your requirement.

One of those , Tadit has already suggested which uses Global.asax application event for the periodical DB updates. But can go through the link about the risk involved

http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx/[^]

Even implementing IHttpModule interface will can be helpful.

Or other option is to use timer in Masterpage .

May be one more option is to have a webservice and add a windows service to schedule the updations periodically.
http://msdn.microsoft.com/en-us/magazine/cc163821.aspx[^]

Hope this helps you...


将其存储在 Session 中.然后,您将可以在所有页面中使用它.
Store that in Session. Then you will be able to use it in all the Pages.


这篇关于计时器滴答应发生与页面加载无关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆