?
Solved

Schedualed Tasks (Asp.net)

Posted on 2006-06-20
7
Medium Priority
?
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

771 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