Link to home
Start Free TrialLog in
Avatar of adamtrask
adamtrask

asked on

Creating a reocurrying event in an asp.net

Hello experts,

Is there a way to create an event of any kind that reocurr automatically every 5 minutes on an asp.net page without using Ajax?

It can be a button click event or some thing similar that prevents the web site from staying idle for more than 5 minutes....?

Thanks
Avatar of kaufmed
kaufmed
Flag of United States of America image

You can add a meta-refresh header. I will refresh the page without any user action.

this.Response.AddHeader("Refresh", "5");  // where "5" means 5 seconds

Open in new window


You can also specify the page to go to:

this.Response.AddHeader("Refresh", "5;URL=http://www.example.com");  // where "5" means 5 seconds

Open in new window


Again, this will occur without any user-intervention, so be judicial in your use of it as you can easily disorient your users if they aren't expecting an automatic refresh. You can search for meta-refresh for more info.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sybe
sybe

javascript function setInterval(), http://www.w3schools.com/jsref/met_win_setinterval.asp

Your question is a bit unclear though.
- "without using Ajax". Why not? What do you mean exactly? Do you mean maybe without javascript?
- "prevents the web site from staying idle". This actually makes no sense, "idle" is not applicable to a website.

It is not very important, but it might help if you describe the problem.
Avatar of adamtrask

ASKER

Sorry guys for not responding earlier.
I was waiting to get back to work where I could try kaufmed suggestion.

Here is the problem:
We have a small web site which is  only used by three people working in shifts - so it is really only one person using it at any given time.

The site was working great until we got a new programmer who tweaked the server in ways we don't understand to accommodate other applications.

The result was this: as long as we use the site, by entering and saving data, moving from one page to another we are fine and every thing runs smoothly.

But if the site is not used for a few minutes and we click on a button to bring up the content of a dropDownList or something similar, the site crawls and we have to wait for almost a full minute or more before the response is completed.

So I am trying to see if I could find a way to keep some sort of activity occurring every few minutes to avoid the idle time (the time where no activity is going on) in order to to maintain the site's responsiveness.

I hope this makes the situation clearer. Thanks

I know I'm stating the obvious here, but it would probably be worth it to investigate the cause of the lag. The solutions above are really only band-aids (as I'm sure you're aware), but I understand why you might want a temporary solution for the interim.

Either approach *should* work unless there is something unique the app is expecting from a user.
Thank you kaufmed: It's working
thanks again