?
Solved

Schedualed Tasks (Asp.net)

Posted on 2006-06-20
7
Medium Priority
?
238 Views
Last Modified: 2006-11-18
I have a file that i need to re-create every 30 mins.  The process involed in this update takes about 30 second so this means it would be to long to do when a normal user is visiting hte page.  I thought about setting a time and if time > 30, then update, however it does take some time and the person would just shut the browser.

I could easily create a page to do this, however i kind of dont want to be clicking a page every 30mins for the rest of my life.  Is there any way to do this?


Also, i need to be able to update this "thing that creates the file" constantly during the development of it, so i need a eays way to restart/refresh it with the new code.

Thanks.

0
Comment
Question by:UnexplainedWays
  • 4
  • 2
7 Comments
 
LVL 15

Expert Comment

by:deepaknet
ID: 16941755
In the server, you can have a VBScript file that is configured with Windows Scheduled Task. Now, from this VBScript, you can use XmlHttpRequest to send a request to the webserver.
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16941791
I was after something on the server side only, because when my computer is off, then this file wont be update.
0
 
LVL 2

Accepted Solution

by:
T3Logic earned 2000 total points
ID: 16941883
What you can do is create the page that you want to run every 30 minutes.

Create a file such as time.txt that will store the time last run.

On your index page or wherever you want to set this up write a procedure that will run asynchronously.

For instance here is the c# code, not sure what language you want it it.
---------------------------
        System.Threading.ThreadStart entry = new System.Threading.ThreadStart();
        System.Threading.Thread thrd =  new System.Threading.Thread(function that runs file);
        thrd.Start();
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16941953
Sow how do i turn that threading into a 30 min timer?
0
 
LVL 2

Expert Comment

by:T3Logic
ID: 16942165
Since this is asp.net,

What language are you using?

I presume your home page is index.aspx

I am not sure if you are using code behind, but guessing that you are.

In the onload portion of the page,

create a date variable to hold the current time.
read the time from time.txt.
Compare the 2.
If difference is greater than 30 minutes
run the desired file in the background

This way the user does not need to wait for the other file to finish.  Even if they close there browser it will still run till finished.
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16943135
Well, this "file" is getting the weather from a web service.

So when someone comes to my site, they will be reading in the old xml file and the temps will be all wrong (thats if no one has come to my site for a while) while the new one is being created.

I wouldn't use the index page, i would use the master page so no matter what page they are viewing it will run.



And yes it's asp.net and it's in C# and yes i always use a code behind file.
0
 
LVL 12

Author Comment

by:UnexplainedWays
ID: 16962625
I think you might be onto something with this threading, i could have a start/stop page.  Basically i go to this page and start the thread, this thread then just keeps running and sleeps for 30 mins at a time and keeps going untill i stop it with the start/stop page (i'll have a text file with the status of the thread, so it will read it @ the 30 mins and kill itself)

This should work :D (last thing i wanted was a thread that i couldnt stop running on the server lol)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question