mercoledì 20 febbraio 2013

Byte Array to Asp Image

If you have a byte array of an image, and you want to show it, you can see the following example.

C# code:


byte[] arr = //get you image byte array
string base64String = Convert.ToBase64String(arr, 0, arr.Length);
Image1.ImageUrl = "data:image/png;base64," + base64String;
Image1.Visible = true;


 Aspx Code:

<asp:Image ID="Image1" Visible = "false" runat="server" Height = "100" Width = "100" />    



My Two Cents ...

Nessun commento:

Posta un commento