如何使用通用处理程序(ASHX)在ASP.NET MVC? [英] How to use Generic Handlers (ASHX) in ASP.NET MVC?

查看:581
本文介绍了如何使用通用处理程序(ASHX)在ASP.NET MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我读<一href="http://www.marklio.com/marklio/CommentView,guid,df8d6471-83fd-4f66-a799-ef8274979f0e.aspx">blog发布有关它但它似乎从我的 ASP.NET论坛

任何想法?

解决方案

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

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


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

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.

这篇关于如何使用通用处理程序(ASHX)在ASP.NET MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆