|
-
December 15th, 2010, 09:15 AM
#1
Help - I can't stopping my timer!
I am implementing an image handler (IHttpHandler serving requests for jpg files) to be used in emails and record the recipient opening the email.
e.g.
<img src="http://www.mydomain.com/tracker.jpg?UID=12345" height="1" width="1" />
I am also working on some code to time how long a user is actually spending reading the email. I've started a Timer (System.Timers.Timer) and that's happily ticking away, recording when the email is opened. BUT it doesn't stop when the email message is closed (It's obviously running on a thread) and my question is...
Does anyone have any idea how I can get the timer to stop when the email is closed? I can't use javascript or any front end code because I'm serving an image request and have hit a dead end. Also, I'm unable to use any scripting in the email - most clients strip out javascript etc. so I need to keep it clean and do it this way.
Thanks for any suggestions!
code in use:
public void ProcessRequest(System.Web.HttpContext context)
{
System.Timers.Timer myTimer = new System.Timers.Timer(10000);
myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed);
myTimer.Start();
}
static void myTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
// ... DB code here to record ticking
}
-
December 15th, 2010, 10:11 PM
#2
Re: Help - I can't stopping my timer!
I do not really understand whats going on couldn't you create an event for when the email is close and: myTimer.Stop(); ?
-
December 16th, 2010, 05:31 AM
#3
Re: Help - I can't stopping my timer!
I've resolved the issue now - much easier to do something with the web logs.
Thanks for looking
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|