I\'m trying to using a Generic Handler to retrieve and display images that are stored in a database.
But its just not working. Ive tried verious of the code below, b
wow, ok. Not sure how much of that is old code, what should be commented out or w/e but try something like this:
public void ProcessRequest (HttpContext context) {
int iconId;
if (string.IsNullOrEmpty(context.Request.QueryString["id"]) || !int.TryParse(context.Request.QueryString["id"], out iconId) )
throw new ArgumentException("No parameter specified");
context.Response.ContentType = "image/gif";
var db = new UdINaturen.UdINaturenContext();
var GetIcon = (from i in db.subcategoryicons
where i.id == iconId
select i.picture).FirstOrDefault();
byte[] buffer = (byte[])Convert.FromBase64String(GetIcon);
context.Response.ContentType = "image/gif";
context.Response.BinaryWrite(buffer);
context.Response.Flush();
}