c# mvc 2 - 为所有图像映射一个包罗万象的路线
我正在尝试制定一条路线来通过正则表达式捕获所有图像请求,并使用图像http处理程序。
我尝试添加正则表达式(与routes.IgnoreRoute 一样),但是,我收到有关路由 url 参数的错误。
我还尝试了以下方法来尝试捕获位图图像,尽管没有捕获任何内容:
routes.Add("ImagesBMPRoute", new Route("{filename}.bmp/{*pathInfo}", new ImageRouteHandler()));
谁能告诉我如何捕获所有“bmp”扩展请求并传递给 ImageRouteHandler
谢谢,
弗兰克
I am trying to make a route to catch all image requests via regex, and use a image http handler.
I've tried adding regex's (as with routes.IgnoreRoute), however, I receive errors about the url parameter for routing.
I have also tried the following to try and catch bitmap images, although nothing is caught:
routes.Add("ImagesBMPRoute", new Route("{filename}.bmp/{*pathInfo}", new ImageRouteHandler()));
Can anyone advise how I can catch all "bmp" extension requests and pass to the ImageRouteHandler
Thank you,
Frank
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
静态文件直接提供给客户端,请确保 web.config 文件包含
查看这篇文章 ASP.Net MVC – 如何路由到图像或其他文件类型
Static files are directly served to clients,be sure that web.config file includes
Take a look this post ASP.Net MVC – How to route to images or other file types