Response.Write--How to show Image

6.4k Views Asked by At

This is my image Url

string fileUrl = file.Link;

I want to show this on Response.Write.How to do it?

Response.Write("<img src='" & fileUrl& "'/>")

Above Code I tried.But it doesn't work.

3

There are 3 best solutions below

0
On BEST ANSWER

And it was that &... It works fine by replacing & with +..

Response.Write("<img src='" + fileUrl+ "'/>")
1
On

let the filePath contain virtual address like shown

string filePath  = "http://localhost:2053/Styles/Images/myPersonalImage.jpg"
Response.Write("<img src='" & filePath & "'/>");
1
On

You need to use Server.MapPath.

string fileUrl = Server.MapPath(file.Link);