Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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
Comments
[no name] 14-Sep-12 11:22am    
As you have already been told. You cannot to that. That is not how the web works. You either need to redesign your website to something that makes sense or create a service that calls that method every 5 minutes or create an application that runs all the time that calls that method every 5 minutes or write an application that is run every 5 minutes by the task scheduler. Reposting this same question over and over is not going to change the answers or change how web sites actually work.
me64 14-Sep-12 11:27am    
Please take a practical example
There is a method called Add()in myclass
[no name] 14-Sep-12 11:31am    
No thank you. I do not need to take a practical example. I have no need for one.
me64 14-Sep-12 11:37am    
Please you get example for me

1 solution

1: asking the same question when you've already had answers is not good practice.
2: Start here[^].
 
Share this answer
 
Comments
me64 15-Sep-12 3:27am    
I dont understand nothing about this link

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