Del via


Displaying the byte[] image in the runtime (without storing it on machine)

Continue from the last blog post:

In the last blog I had shown how to convert the byte [] to image and vice-versa. But sometimes there can be a need to display the image without storing it in the machine (server).

One way to achieve this to use an <iframe> control and assign a page to its src attribute.

Here is code snippet for that:

<html xmlns="https://www.w3.org/1999/xhtml">

<head runat="server">

<title>Show Image in Frame</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<iframe height="50" id="frm" width="118" frameborder="0" runat="server" src="MyPage.aspx" scrolling="no" > </iframe>

<br />

</div>

</form>

</body>

</html>

And code in the MyPage.aspx (codebehind)

public partial class MyPage : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

Response.ContentType = "image/gif";

Response.BinaryWrite(byteImage);

}

}

Comments

  • Anonymous
    July 25, 2007
    Continue from the last blog post: In the last blog I had shown how to convert the byte [] to image and