I have loaded an byte array image from a web service to my asp.net website.
I need to display it on the web page as soon as execute the web service.
I have tried using generic handler, but i could not do it since there wasn’t way to pass byte[] image into the generic handler
void Button2_Click1(object sender, EventArgs e)
{
this.verifyTemplates();
byte[] userImg;
try
{
matchTemp.templateService hs = new matchTemp.templateService();
bool s1 = hs.matchTemplates(template, out userID, out userName, out userImg);
// userImg is the byte image i need to display
}
catch(Exception exc)
{
// vLabel.Text = exc.Message;
}
}
What you’re looking for is a Data URL. You can get the base64 of a byte array like this (change the image type as required)
In the view:
This won’t work in IE 7 or earlier, if you need to support those then you’ll want to look at MHTML.