Click here to Skip to main content
15,894,017 members
Articles / Web Development / ASP.NET

Tracking Emails for Open/Read

Rate me:
Please Sign up or sign in to vote.
4.14/5 (24 votes)
9 Aug 20063 min read 149.9K   4.1K   73  
Tracking Emails for Open/Read
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace etrack
{
	/// <summary>
	/// Summary description for etrack.
	/// </summary>
	public class ImageServer : System.Web.UI.Page
	{
		private void Page_Load(object sender, System.EventArgs e)
		{
			// content type should be resolved programmatically
			Response.ContentType = "image/jpeg";

			if (!IsPostBack) Track();
			Response.WriteFile(GetImageFileByID());
		}

		private void Track()
		{
			string strCustomerID = Request["custID"];
			string strCampaignID = Request["campID"];

			// log the tracking event along with the 
			// customer and campaign id here..

			// optionally log the locatoin and date/time of the 
			// customer..
			string strRemoteHost = Request.UserHostAddress;
			// track the location if possible by the IP address

			string strDateTime = DateTime.Now.ToString();

		}

		private string GetImageFileByID()
		{
			return Request["imageID"];
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Architect TechAnts Technologies Limited
Bangladesh Bangladesh

Mohammad Ali Azam has been working as an Architect in TechAnts Technologies Limited, located in Dhaka, Bangladesh since 2008.


Azam had long been working as a Senior Java Enterprise Architect in several companies and now has been working on software development using ASP.NET platform. He is as competent in both Visual C# and Visual Basic .NET as he is in J2EE.


For last couple of years, he has actively been working on Email Campaign Software, ECMS, Search Engine Integration, Hospital Management System, Knowledge Management System, Human Resource Management System and open source PHP web application such as Joomla, WordPress and Magento. Along with his regular tasks in the industry, he has also been researching on inventing technologies to promote Rapid Application Development (RAD).


While he works on designing various component models utilizing the best industry practices and the latest specification of UML, at leisure, he plays with his little baby girl and watches Sci-Fi movies on satellite TVs (or on DVDs) with his
wife!


Comments and Discussions