Asp.Net Show Image from Byte Array

We can show Image from Byte Array

ASP.Net control

     <asp:Image ID="Image1" runat="server" />

Server Side C# Code

		//Get File Bytes         
        Byte[] bytes = flUpload.FileBytes;

        //Convert to Base 64 
        string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
        //Show using ImageURL properties 
        Image1.ImageUrl = "data:image/png;base64," + base64String;

Show Image


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s