Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3485786
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:56:58+00:00 2026-05-18T10:56:58+00:00

I need to call function on timer (lets say onTickTack() function) and reload some

  • 0

I need to call function on timer (lets say onTickTack() function) and reload some info in ASP.NET MVC project. I know that there are several ways to do that, but which one is the best by your opinion?

Note: the function should be called from one place only, and should be called every X mins till application is up.

EDIT 1:
Reload some info – for example I have something in the Cache and I want to update it from DB on timer – once a day in certain time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:56:59+00:00Added an answer on May 18, 2026 at 10:56 am

    The answer to this question would very much depend on what do you mean by reload some info in ASP.NET MVC project. This is not a clearly stated problem and as such, more than obviously, it cannot have a clearly stated answer.

    So if we assume that by this you want to periodically poll some controller action and update information on a view you could use the setInterval javascript function to periodically poll the server by sending an AJAX request and update the UI:

    window.setInterval(function() {
        // Send an AJAX request every 5s to poll for changes and update the UI
        // example with jquery:
        $.get('/foo', function(result) {
            // TODO: use the results returned from your controller action
            // to update the UI
        });
    }, 5000);
    

    If on the other hand you mean executing some task on the server at regular periods you could use the RegisterWaitForSingleObject method like this:

    var waitHandle = new AutoResetEvent(false);
    ThreadPool.RegisterWaitForSingleObject(
        waitHandle, 
        // Method to execute
        (state, timeout) => 
        {
            // TODO: implement the functionality you want to be executed
            // on every 5 seconds here
            // Important Remark: This method runs on a worker thread drawn 
            // from the thread pool which is also used to service requests
            // so make sure that this method returns as fast as possible or
            // you will be jeopardizing worker threads which could be catastrophic 
            // in a web application. Make sure you don't sleep here and if you were
            // to perform some I/O intensive operation make sure you use asynchronous
            // API and IO completion ports for increased scalability
        }, 
        // optional state object to pass to the method
        null, 
        // Execute the method after 5 seconds
        TimeSpan.FromSeconds(5), 
        // Set this to false to execute it repeatedly every 5 seconds
        false
    );
    

    If you mean something else, don’t hesitate to provide more details to your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC web app and have a function that I need
I need to call a const function from a non-const object. See example struct
I am using jQuery and JavaScript, I need to call the jQuery function inside
I need to find all occurrences of a function call in a C++ file
I need a function that I can call when somthing is done, for example
Say I need to call a javascript file in the <head> of an ERb
I have a VB6 COM component which I need to call from my .Net
Lets say I have a C++ program and I want to call functions from
I currently call a function to filter some HTML in PHP like this FilterHTML($string)
Ours is a huge project. I need to call certain functions in my code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.