ASHX handler with ASP.NET MVC 3 and Razor

岁酱吖の 提交于 2019-12-21 11:43:50

问题


I would like to use Silverlight Multi File Uploader with ASP.NET MVC 3. The problem is that I need to use ashx handler to handle file upload (the handler is part of the library). How can I integrate the handler with ASP.NET MVC 3 (I'm using Razor view engine) ?


回答1:


My guess is that it is easier because it is part of a (older?) third party library and it easier to just follow the instructions that tells you to set something in web.config. You should be able to ignore requests to *.ashx by ignoring routes to *.ashx files. You should be able to use something like this, but I haven't tried it myself:

routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");



回答2:


The problem is that I need to use ashx handler to handle file upload

Who told you that you need a handler? Everything that you could do in a handler could be done in a controller action. You even have access to the raw Request.InputStream if necessary.



来源:https://stackoverflow.com/questions/7289036/ashx-handler-with-asp-net-mvc-3-and-razor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!