Email Tracking Using ASP.NET not working
<p>I have a problem tracking emails.I want to know who read my email.When i send mail to my outlook it works fine but when i want to send it across the network it does not work.ie. When i debug my code and give path of localhost it works but when i give path of my PC on the network it does not work i have hosted the website on IIS locally.Here is my PC name and port where i have configured it PC-50:102
Here is code.
 Http Module</p>

<p>public class HttpModuleClass : IHttpModule
    {
        //public event EventHandler BeginRequest;</p>

<pre><code>    public void Dispose()
    {

    }

    /// &lt;summary&gt;
    /// public varibles
    /// &lt;/summary&gt;
    string footerFile = "~/images/footer.png";
    //string footerFile = "~/images/ajax-loader.gif";
    Email_Calls bl_email_calls = new Email_Calls();

    /// &lt;summary&gt;
    /// Init methoed
    /// &lt;/summary&gt;
    /// &lt;param name="context"&gt;&lt;/param&gt;
    public void Init(HttpApplication context)
    {
        context.BeginRequest += new System.EventHandler(GetImage_BeginRequest);
    }

    /// &lt;summary&gt;
    /// handles requests made to server and call update email read time
    /// &lt;/summary&gt;
    /// &lt;param name="sender"&gt;&lt;/param&gt;
    /// &lt;param name="args"&gt;&lt;/param&gt;
    public void GetImage_BeginRequest(object sender, System.EventArgs args)
    {
        //cast the sender to a HttpApplication object
        System.Web.HttpApplication application = (System.Web.HttpApplication)sender;
        string url = application.Request.Path; //get the url path

        string pattern = @"/images/(?&lt;key&gt;.*)\.aspx";

         //create the regex to match for beacon images
        Regex r = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
        if (r.IsMatch(url))
        {
            MatchCollection mc = r.Matches(url);
            if ((mc != null) &amp;&amp; (mc.Count &gt; 0))
            {
                string key = (mc[0].Groups["key"].Value);
                bl_email_calls.UpdateSystemEmailAuditReadDate(key);

            }

            //now send the REAL image to the client
            //application.Response.ContentType = "image/gif";
            application.Response.ContentType = "image/png";
            application.Response.WriteFile(application.Request.MapPath(footerFile));

            //end the response
            application.Response.End();
        }
    }
}
</code></pre>

<p>And here is code which is creating all the mess</p>

<pre><code> string emailTemplateBody = TextArea1.Value;
    This works
</code></pre>

<p>emailTemplateBody += "<br />.aspx   />";</p>

<p>This does not works
emailTemplateBody += "<br />.aspx style='opacity:0.0; filter:alpha(opacity=0);'  />";</p>

<pre><code>       string templateName = txtTemplateName.Text;


       string toEmail=txtTo.Text;


       //// Get unique Key after registring mail to be sent
       string key = bl_email_calls.RegisterSystemEmailAudit("1", templateName, DateTime.Now);


       emailTemplateBody = emailTemplateBody.Replace("&lt;keyvalue&gt;", key);
       //// sending e-mail
       bl_email_calls.SendMailMessage(toEmail, templateName, emailTemplateBody, key);
       using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["webConnectionString"].ToString()))
       {
           var cmd = new SqlCommand("insert into dr_emailtemplate (Practice_Code ,Template_Name ,TemplateBody ,Created_By ,Created_Date)" +
               "values('" + 1010 + "', '" + templateName + "', '" + "Test Body" + "', 'Mairaj " + key + "', getdate())", cn);
           cn.Open();
           cmd.ExecuteNonQuery();
           cn.Close();
       }
</code></pre>
