Search code examples
.netasp.netasp.net-mvchttphandlerashx

How to use Generic Handlers (ASHX) in ASP.NET MVC?


I need a image generator in my ASP.NET MVC application, but I don't know if it is possible to use ASHX in ASP.NET MVC.

If there is an class similar to IHttpHandler that inherits IViewDataContainer, then I could use ViewData.Model on my ASHX.

I read a blog post about it but it seem outdated from the info I got in the ASP.NET forum

Any ideas?


Solution

  • You should just be able to return the image from the action? See here for more.

    And yes, you can use ashx alongside MVC (by telling it to ignore the route) - but I'm not sure that is the best approach unless it is to re-use existing code.


    Sorry guys, the link has been removed. It happens.