每五分钟调用一次(执行,呼叫等)方法

编程入门 行业动态 更新时间:2024-10-14 16:24:45
本文介绍了每五分钟调用一次(执行,呼叫等)方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的网站上有两个页面.用户只能看到第一页.用户无权访问第二页.从不加载第二页. 但是我在第二页上有一个名为Add()的方法,该方法位于一个名为myfolder的文件夹中.如何每五分钟实施一次此方法. 我使用了以下代码,但是有问题. 在页面加载状态下执行该方法.如果关闭此页面,请勿一次调用此方法.在运行ASP.NET时,我并没有停止在ASP.NET中,只是关闭了浏览器屏幕. 我想要的是,即使用户没有打开页面,该方法也将在白天自动应用

There are two pages on my website. Only the first page the user sees. User does not have access to the second page.The second page is never loaded. But i have on the second page method called Add(), this method is in a folder called myfolder. How do I implement this method every five minutes. I''ve used the following code but there is a problem. Method is executed when the page is loaded condition. If you close this page, do not call this method at a time. While ASP.NET is running on, I did not stop in ASP.NET, I just close the browser screen. What I want is that the method will automatically be applied during the day, even when the user does not open the page

<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="300000" /> <asp:UpdatePanel ID="UpdatePanell" runat="server" UpdateMode="Always"> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers>

protected void Timer1_Tick(object sender, EventArgs e) { myclass a=new myclass; a.Add(); }

推荐答案

1:当您已经有了答案时问同样的问题不是一个好习惯. 2:从此处开始 [ ^ ]. 1: asking the same question when you''ve already had answers is not good practice. 2: Start here[^].

更多推荐

每五分钟调用一次(执行,呼叫等)方法

本文发布于:2023-11-25 04:51:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628410.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:五分钟   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!