Click here to Skip to main content
15,906,558 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.NET
<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>


C#
protected void Timer1_Tick(object sender, EventArgs e)
       {
           myclass a=new myclass;
           a.Add();
       }
Posted
Updated 12-Sep-12 22:10pm
v4
Comments
Kuthuparakkal 11-Sep-12 2:12am    
post code, also if user never see or load a page then why do you need a method from that page? can you flip to some static class and call everytime ? Also think of thread executes in background and polls your so far glorified "Add()" method of static class or static method every 5 minutes.
AmitGajjar 11-Sep-12 9:06am    
What you do in Add() method ?
[no name] 11-Sep-12 9:10am    
Redesign your website so it makes some sense or put the method in a service and call it every 5 minutes or put that method in a regular application and call it every 5 minutes on a timer, or put that method in an application and call the application every 5 minutes using the task scheduler.
Sandeep Mewara 11-Sep-12 9:42am    
Agree with Wes.
ZurdoDev 11-Sep-12 14:30pm    
You can use .ajax in jQuery. http://api.jquery.com/jQuery.ajax/ But, you should really make it a webservice.

1 solution

 
Share this answer
 
Comments
me64 13-Sep-12 2:47am    
this is source in C#, But i want ASP.NET with C#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900