-1

I am new to this functionality, our company projects are containing similar functionality but the store the image path with in the server and they retreive according to that. But I want to store the image as image type in database and I want show as it is in the Asp.net page(imagebox).

Thanks in Advance

2 Answers2

0

You need to serialize the image to a binary format that can be stored in a SQL BLOB column please check this or check that as well.

Community
  • 1
  • 1
Rahul
  • 5,603
  • 6
  • 34
  • 57
0

And if you want to show it to pass it client you can create specific method that will return an image and use this url in src for imagebox:

public ActionResult GetAvatar(int id) {
    using (var dbContainer = new MainDBContainer()) {
        return File(dbContainer.UserSet.First(p => p.Id == id).Image.Image,"image/png");
    }
}

Or you can use Base64 encoding.