|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
namespace LearningWebApplication
{
public class EmailViewedNotificationHandler : IHttpHandler
{
private EmailNotificationService _emailNotificationService;
public EmailViewedNotificationHandler()
{
_emailNotificationService = new EmailNotificationService();
}
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
string id = context.Request.QueryString["id"] as String;
if (String.IsNullOrEmpty(id)) return;
Guid guid = new Guid(id);
_emailNotificationService.MarkEmailRead(guid);
// render the image!
MemoryStream ms = new MemoryStream();
Bitmap bitMap = new Bitmap(context.Request.PhysicalPath);
bitMap.Save(ms, ImageFormat.Png);
byte[] buffer = ms.ToArray();
context.Response.Clear();
context.Response.ContentType = "image/png";
context.Response.BinaryWrite(buffer);
context.Response.End();
}
}
}
|
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.
My name is Mohammad Azam and I have been developing iOS applications since 2010. I have worked as a lead mobile developer for VALIC, AIG, Schlumberger, Baker Hughes, Blinds.com and The Home Depot. I have also published tons of my own apps to the App Store and even got featured by Apple for my app, Vegetable Tree. I highly recommend that you check out my portfolio. At present I am working as a lead instructor at DigitalCrafts.
I also have a lot of Udemy courses which you can check out at the following link:
Mohammad Azam Udemy Courses