Performing an Operation Once a Day

I want to write a script that runs just once in a day.
Like i want to add a poll of the day or send all emails after one day or something like that then how can i do?
I thought of threading but if the web application closes and then on its start how would it know if the actions have been taken? do I have to store them in some files like last poll update time etc.

Is there a better way of doing this? Moreover can i make a class that is visible to all the sessions (just like application variables) and any script can call that class or its member functions.
7/27/2005 1:39:23 PM 91979 articles. 3 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 32

There are several ways to go about this. You could have the web app fire the tasks (yes, you'd have to store the status in a file or database somewhere), but because ASP.NET may restart itself, the application may shut down, etc., you won't be able to control when your daily processes run. If you are simply adding content to a database, you might choose to schedule a database job to run at a specific time. You could use the Windows scheduler to fire off an exe or to run some VBScript via WSH at a predetermined time. Or, you may choose to create a Windows service to coordinate execution of each task.

To answer your second question: yes, you can create a class that is visible to all sessions. A class built using the singleton design pattern will accomplish this, with the side-effect of also being accesible to your non-HttpContext daily tasks.

||| Kristopher Cargile
7/27/2005 2:41:54 PM
Thanks for the reply.

Yes, choosing a database schedule is suitable for database jobs. I dont have direct access to my server ( i have shared hosting), so i dont think i can write a windows scheduler. Moreover i would like to write a generic script that will work on any client machine.

I didnt quite understand the second point. What is a class built on a singleton design? The side effect that it is accessible to non httpcontext tasks mean it can be accessed without the http request also?
7/27/2005 5:09:52 PM
I did the same thing with an application I wrote, this was delivered on a shared hosting plan. 
I added a little script to the homepage which checked if todays activity had been completed, if not, it did it and then changed the flag.
Of course, someone had to visit the homepage at least once a day - but that wasn't a problem, since the customer visited it every hour anyway.
We had two versions - one which stored data in a database, another stored the flag in an XML file.

7/27/2005 6:06:06 PM
Ya this is a good idea. I had thought of making a page that the web team will visit each day, which will execute the scripts. This way i can perform the operations. 

Is it possible to make a class that sends email. This must be visible to the entire application. How can i do that?
7/27/2005 6:55:35 PM
Yes, things will get a bit trickier in a shared hosting environment. Your only option may be to have a page check a status flag and kickoff the script as has been suggested and, as long as thight scheduling is not required, should work just fine.

A singleton class can only ever have one instance, meaning that data can be easily shared between objects, etc. The advantage to using this approach versus the ASP.NET Application object is that other, non-web pieces of your application can gain access to the object. If you'd like to learn more about singleton, reference Design Patterns or the
MS P&P website.

||| Kristopher Cargile
7/27/2005 8:27:47 PM
Thanks. The link was of great help.
7/28/2005 2:58:27 PM

Similar Artilces:

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Getting started with JScript.NET
I'm a Javascript and Actionscript developer, and the thought of being able to do server-sides in something I know was too good to resist. Does anyone know some good tutorials for developing ASP.NET pages in JScript?  I can find lots of console code, but simple things are hard: like I can't even figure out how to print something out to the web page (just a string). What I'm really trying to do is access a database, verify a login, and print JSON out to the response.  What should I do to start?  Is there a better way to do this? (IE: using some JSON library already?). I'm commun...

Getting started .net website
Hi folks,Does anyone here know of a good website to just sit back and read for learning .net? Thanks in advance.Baldeep Right here... Click the Get Started and Learn sections here. Quite a few out there - - this one, has a lot of good videos -  also, but then, I might be a little prejudiced David WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(P...

Getting Started with .net and a few questions
Hello I've done some asp and php programming along with various other languages in the past and slowing getting my head around .net.I have a small project of creating a Holiday Booking system on our Intranet and just trying to get the first part to work properly will hopefully get me sorted for the whole project. The Intranet is running on .net 2 and I prefer to use the VB code rather than C#. This is connecting to an SQL server.My initial page that I am trying to create is just for an admin user to view which dates in a table have been specified as Bank Holidays and be able to add ...

Getting Started Without VS.NET
Hi all, does anyone know how any online resources that can show me how to create web apps that include code-behind, and uer controls without using VS.NET? I have VS.NET in work, but would also like to do work at home, but cannot install VS.NET on my home laptop because I simply dont' have the space or processor power. Any online articles would be welcome, as will any open-source apps - I currently have SharpDevelop, but I find it unstable as it crashes my laptop alot of the time. Thanks Tryst Did you try Web Martix? It is a FREE tool from Microsoft.Regards, Narayana ...

Newbie Question
I have a new project which has just started. One of the requirements is to generate XML files. Do I have to create schema files? Does anyone have a tutorial or sample code to help me get started. I have some background using XML, but not in .NET. Thx Mark How to create a new xml file with XmlDocument? More examples hereSonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum Thanks, this is very helpful. What do I need to do extra to setup the schema for this xml file? Is the schema really necessary as well? Thx Mark You dont need to define any sc...

How to get the MyTextBox.Text when performing operations on the server side?
Situation:  I have a web form. There is a text box and a button on it. In the event OnButtonClick (runat=server) I am trying to save the data that was typed to the textbox before submitting that page to the server but that "text" property of the button appears to be empty. Why is that and how do I get the info I type in to save into a file?  Thanks a lot.Max PavlovMy Blog If you type anything in that TextBox then TextBox1.Text will contain the text, did you disabled ViewState? Are you using any Ajax?CheersAlMy BlogMapStats.NETPlease click on 'Mark a...

Getting started with .net mobile/wireless application programming
Hi friends, I am very much amateur to the world of mobile/wireless application programming that's why m is having thousands of doubts and confusion regarding the technology. My first few concerns about the terms i.e. mobile web applications vs. windows mobile applications first thing are these 2 things are same if not what are the main differences. I hope you will also show me some light how to move further ahead in this field as i m having small exp approx. 1.5 yrs in application. Any help in the form of links, URL, code will be highly appreciated. Thanks in advanced...

Getting started with mySQL Connector/Net 5.1
i have a vs2005 project which someone else built.  I need to connect to mySQL in this project. it is currently using the OleDbConnection to mySQL and I cannot make the connection, so I was told by the developer to try the the mySQL Connector/Net 5.1.  I have read the very encouraging documentation.  I am in a file called SqlDataProvider.vbI want to replace Dim objConnection As OleDbConnectionwithDim objConnection As MySqlConnection I get the blue squiggly  "MySqlConncection is undefined." I added this import to the top. Imports MySql.Da...

Window performance getting worse when Mobilink service auto-start
Hi, I added a Mobilink service in sybase central ( General - startup type: automatic; Configuration - parameters: -zu+ -v -zs ers -c dsn=ers -q; Account as default; Dependencies - after ASA server started. The service started wothout a problem, but the window performance becomes very slow. Even open window explorer or copy/paste file could cost 2 minutes. Then I change the startup type to manual, the window performance is better. Is it normal that the mobilink service will lower the window performance? Or I could set sth. to avoid it? Thank you. Regards, Leon ...

getting start with and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

Web resources about - Performing an Operation Once a Day -

University of Music and Performing Arts, Vienna - Wikipedia, the free encyclopedia
The University of Music and Performing Arts, Vienna ( German : Universität für Musik und darstellende Kunst Wien , abbreviated MDW ) is an Austrian ...

Demi Lovato falls on stage while performing Cool For The Summer - video
DEMI Lovato fell flat on her back during a gig at New York City’s iconic Madison Square Garden venue on Friday night.

Molybdenum this year's worst-performing commodity
An obscure metal used to make steel has become this year's worst-performing commodity.

You think AFL coaches face pressure: what about principals of high-performing state schools?
Being a high-achieving non-selective state school produces high demand for places and a lot of pressure to keep improving results. Meet Pitsa ...

Internet in tears over video of kids choir performing Arabic welcome song
It’s a shaky and grainy video, but its message is what has the Internet in tears.

How Are Presidential Candidates Performing on YouTube?
With a GOP debate tomorrow night , we decided to check in and see how Republican presidential candidates are performing on YouTube. To no surprise, ...

Building High-Performing Organizations Game played at GOAT15
... Agile Tour for yet another year, and Mark debuted a brand new game as part of his GOAT15 presentation. “Beyond Scrum: Building High-Performing ...

Mike Birbiglia making new movie w/ Keegan-Michael Key, Chris Gethard & more ++ performing at LGBTQ benefit ...
Mike and the cast of 'Don't Think Twice' Mike Birbiglia wrote, directed and starred in 2012's acclaimed Sleepwalk with Me. He's got a new movie ...

Studios are making billion-dollar deals with Netflix, but they have almost no idea how their shows are ...
... Why not?” The answer, of course, is that Netflix would then lose an enormous advantage. With a studio knowing how its content is performing, ...

InvenTrust Properties Corp. Announces Acquisition of Two High Performing Open Air Shopping Centers
InvenTrust Properties Corp. (“InvenTrust” or “the Company”) today announced that it has acquired two high performing ...

Resources last updated: 12/28/2015 7:49:09 PM