Leider ist der Eintrag nur auf Amerikanisches Englisch verfügbar. Der Inhalt wird unten in einer verfügbaren Sprache angezeigt. Klicken Sie auf den Link, um die aktuelle Sprache zu ändern.

Scenario

You have an SQL datatable which contains a BLOB column to save images direcly in your DB as binary and want to show the images on your website.

Solution

Create your EntityFramework and Controller with the common wizards and methods.

Because you cannot directly give a Byte Array to your browser, you have to edit your .cshtml file to insert the images directly into your HTML code as Base64 strings:


A method which offers the images via Controller would be to add ActionResult methods (and/or parameters) for your images.

In your Controller:

Now the src attribute of the image tag should point to /Home/GetImage.

In your View:

 

Reference

  [email protected]