How Can ASP.Net MVC controller return an Image?

Mark M

Total Post:28

Points:196

Posted by  Mark M
 1763  View(s)
Ratings:
Rate this:

Can I create a Controller that simply returns an image asset?

I would like to route this logic through a controller, whenever a url such as the following is requested:

www.mywebsite.com/resource/image/topbanner

The controller will look up topbanner.png and send that image directly back to the client.

I've seen examples of this where you have to create a View - I don't want to use a View. I want to do it all with just the Controller.

Is this possible?

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.