安装CaptchaMVC后,我导航到我要测试功能的页面 - 〜/ about。
对于图片localhost:51860/DefaultCaptcha/Generate?t=6d9ab0cefbb8496582b1db592eff66f
,我看到链接断开。
我添加了routes.IgnoreRoute("DefaultCaptcha/{*pathInfo}");
并尝试routes.IgnoreRoute("DefaultCaptcha/Generate");
到我的路线顶部,但图片仍然没有出现,导航到图片网址会返回404找不到错误。
当我从Global.asax删除所有路由时,这样可以正常工作。
我认为这个模式与此路线相符:
routes.MapRoute(name: "WholeCountryCategoryResults1", url: "{categoryName}/{searchTerm}/", defaults: new { controller = "Results", action = "SearchWholeCountryCategory" });
其他路线无关紧要,因为规则按顺序执行,那么这里的问题是什么?
感谢。
答案 0 :(得分:4)
对于那些可能遇到同样问题的人,只需设置一条到验证码提供商的控制器和操作的路径:
routes.MapRoute(name: "DefaultCaptchaRoute", url: "DefaultCaptcha/Generate", defaults: new { controller = "DefaultCaptcha", action = "Generate" });