URL中未指定区域时,我的控制器被击中:
https://localhost:441/wholesale_signup,它将找不到该视图并抛出错误。
如何防止该控制器首先被打到只有404s?
仅在提供区域和控制器时才应点击:https://localhost:441/customerservice/wholesale_signup
所以我想我不确定如何表达我的问题,但是经过几个小时的搜索,我找到了解决方案:
ASP.NET MVC 2 RC 2 returns Area-specific controller when no area specified
routes.MapRouteLowercase(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "Default.Controller.Namespace" }
).DataTokens["UseNamespaceFallback"] = false; ;