I have a folder created at the root of a Web Api
project named Images
. At localhost
I write them as follows:
File.WriteAllBytes(HttpContext.Current.Server.MapPath("~/Images/") + image.Name, image.Image);
To display the images in localhost
I only need the address of the same. So, in the controller I create a ViewBag that receives the image address (Ex: http://localhost:49730/Images/Product1.jpg
) and with this code I can display it:
<a href="@ViewBag.Image">Abrir Imagem</a>
Once you have published in Windows Azure
when saving the image, it is not being retrieved from the url.
What needs to be done other than localhost
to work on Windows Azure
?
Update: before publishing in windows azure I have published the azure address in place of localhost, other services work normally, only the images that are not being saved / recovered.