如何使用通用处理程序(ASHX)在ASP.NET MVC?如何使用、程序、ASHX、MVC

由网友(我非薄荷为何心凉)分享简介:我需要在我的ASP.NET MVC应用程序中的图像生成,但我不知道是否有可能使用ASHX在ASP.NET MVC中。如果有继承IViewDataContainer一类类似的IHttpHandler,然后我可以在我的ASHX使用ViewData.Model。我读blog发布有关它但它似乎从我的 ASP.NET论坛 任何想...

我需要在我的ASP.NET MVC应用程序中的图像生成,但我不知道是否有可能使用ASHX在ASP.NET MVC中。

如果有继承IViewDataContainer一类类似的IHttpHandler,然后我可以在我的ASHX使用ViewData.Model。

我读blog发布有关它但它似乎从我的 ASP.NET论坛

任何想法?

解决方案

您应该只能够从操作返回的形象呢?请参阅此处更多。

是的,你可以使用旁边的ashx MVC(告诉它忽略路线) - 但我不知道这是最好的办法,除非它是现有的code再利用。

对不起球员,链接已被删除。它发生。

ASP.NET MVC开发应用 T SQL编程

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?

解决方案

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.

阅读全文

相关推荐

最新文章