ElH*_*aix 2 routes c#-4.0 asp.net-mvc-3
安装CaptchaMVC 后,我导航到要测试功能的页面 - ~/about。
对于图像localhost:51860/DefaultCaptcha/Generate?t=6d9ab0cefbb8496582b1db592eff66f,我看到一个断开的链接。
我添加routes.IgnoreRoute("DefaultCaptcha/{*pathInfo}");并尝试routes.IgnoreRoute("DefaultCaptcha/Generate");到我的路线的顶部,但图像仍然没有出现,导航到图像 url 返回 404 not found 错误。
当我从 Global.asax 中删除所有路由时,这工作正常。
我认为的问题是这种模式匹配这条路线:
routes.MapRoute(name: "WholeCountryCategoryResults1", url: "{categoryName}/{searchTerm}/", defaults: new { controller = "Results", action = "SearchWholeCountryCategory" });
Run Code Online (Sandbox Code Playgroud)
其余的路线应该无关紧要,因为规则是按顺序执行的,那么这里有什么问题呢?
谢谢。
对于那些可能遇到同样问题的人,只需设置一条到验证码提供者控制器和操作的路由:
routes.MapRoute(name: "DefaultCaptchaRoute", url: "DefaultCaptcha/Generate", defaults: new { controller = "DefaultCaptcha", action = "Generate" });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2194 次 |
| 最近记录: |