Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Timer Control in APS.NET ?

Reply
Thread Tools

Timer Control in APS.NET ?

 
 
abhishek007p@hotmail.com
Guest
Posts: n/a
 
      03-02-2006
HI,

i am using visual web developer for .net 2.0.

does .NET 2.0 comes with a timer control, i was unable to find it in
the IDE, where is it ?


thanks,
Abhishek

 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      03-02-2006
Peter Bromberg posted this Rob Howard sample a few days ago :

using System;
using System.Web;
using System.Threading;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace BlackbeltBLL {
public class BackgroundService : IHttpModule {
static Timer timer;
int interval = 5000;
public String ModuleName {
get { return "BackgroundService"; }
}

public void Init(HttpApplication application) {
// Wire-up application events
if (timer == null)
timer = new Timer(new TimerCallback(ScheduledWorkCallback), application.Context, interval, interval);
}

public void Dispose() {
timer = null;
}

private void ScheduledWorkCallback (object sender) {
HttpContext context = (HttpContext) sender;
Poll(context);
}

void DoSomething (HttpContext context) {
}

#region DB Poll
void Poll (HttpContext context) {
SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["Northwind"]);
SqlCommand command = new SqlCommand("SELECT * FROM changenotification", connection);
SqlDataReader reader;
string key = ConfigurationSettings.AppSettings["SqlDependency"];
connection.Open();
reader = command.ExecuteReader();
while (reader.Read()) {
string tableKey = String.Format(key, reader["Table"]);
if (context.Cache[tableKey] != null) {
int changeKey = int.Parse( context.Cache[ String.Format(key, reader["Table"])].ToString() );
if (changeKey != int.Parse(reader["ChangeID"].ToString() ))
context.Cache.Remove(tableKey);
}
}
connection.Close();
}
#endregion
}
}

---000---




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
<(E-Mail Removed)> wrote in message news:(E-Mail Removed) oups.com...
> HI,
>
> i am using visual web developer for .net 2.0.
>
> does .NET 2.0 comes with a timer control, i was unable to find it in
> the IDE, where is it ?
>
>
> thanks,
> Abhishek
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I know about the shutdown timer, is there a "switch on" timer... Mal Carter Computer Support 3 01-12-2008 01:58 AM
page timer, or redirect timer Simon ASP .Net 1 11-04-2005 07:14 PM
System.Timers.Timer/System.Threading.Timer Not Firing At All on Dev Server james.e.coleman@gmail.com ASP .Net 1 02-22-2005 09:41 PM
Re: Question concerning Timer Control Kevin Spencer ASP .Net 2 09-21-2004 08:36 PM
System.Timers.Timer vs. System.Threading.Timer Kelsang Wangchuk ASP .Net 0 07-31-2003 04:28 PM



Advertisments