I have to show runtime generated image on a View in ASP.NET MVC web application. How can I render this image - should I use an .aspx or .ashx file?
Asked
Active
Viewed 502 times
1
-
You've got a full answer here: http://stackoverflow.com/questions/186062/can-an-asp-net-mvc-controller-return-an-image – Dec 31 '09 at 16:18
-
Also, I'd suggest not using the file system as an intermediary; pick one of the solutions that returns a stream and just send the backing stream that contains your image down the wire. – Dec 31 '09 at 16:20
2 Answers
0
If you choose between aspx and ashx - ashx is the better because they are lighter. In ASP.NET MVC you can also create your own ImageResult and use Controller's action to render images. You can use GDI++ to generate the images. If you need transparent images I suggest you save all images as .png files because the quallity of GDI++ generated .png-s is better than any other format.

Branislav Abadjimarinov
- 5,101
- 3
- 35
- 44