Tuesday, March 24, 2009

job scheduling which work at time interval in web application in asp.net

I am created that type of schedule which work properly. if that is helpfull for u then u appreciate it.

using System.Threading;

as namespace

following add in global.asax.cs

protected static Timer _timer;

protected void Application_Start(object sender, EventArgs e)
{
if (_timer == null)
{
var timerCallback = new TimerCallback(JobModulecls.jobshedule);//jobschedule is method which define in JobModulecls class as static method
var startTime = 0;
var interval = 60000; // 60 seconds
_timer = new Timer(timerCallback, null, startTime, interval);
}

}

protected void Application_End(object sender, EventArgs e)
{
_timer = null;
}

public sealed class JobModulecls
{
public static void jobshedule(object state)
{
//here u can write job shcheduling work such as
// coonect to database and work on table on time day schedule

}
}
AJAX, asp, Asp.net, asp.net and sql server security, Asp.net IntemIndex, C#, Css, DataBinder.Eval, DataKeyNames, Datalist, Datapager, DataSet, DataTable, DropDownList, FindControl, gridview, JavaScript, jquery, Listview, Paging, Regex, RegularExpression, Repeater, Server side validation, Sql Server, timer, timercallback, Validation, XML, xmlnode, XPath