我有以下链接MVC ActionLink的GET工作不
<a href="@Url.Action("Index", "Inspection")"><i class="fa fa-user-md"></i> Inspections</a>
在我的路线,我有以下
routes.MapRoute("Inspections", "{controller}/{action}/{id}", new { controller = "Inspection", action = "Index", id = UrlParameter.Optional });
在Visual Studio中,当我点击我活的服务器我它的作品的链接,得到一个白色的页面,用以下粗体 xxx -/inspection /和一个链接[到父目录]
应用程序中的所有其他链接工作正常,并且如预期的那样 现在我必须去和在此改变URL地址栏去XXX /检查/指数
索引方法的确也有[HTTPGET]
编辑1: 我尝试以下,我也尝试过移除路线
routes.MapRoute("Inspection", "{controller}/{action}/{id}", new { controller = "Inspection", action = "Index", id = UrlParameter.Optional });
编辑2:
这里是所有路由我有
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("Login", "{controller}/{action}/{id}", new { controller = "Login", action = "Index", id = UrlParameter.Optional });
routes.MapRoute("Employees", "{controller}/{action}/{id}", new { controller = "Employees", action = "Index", id = UrlParameter.Optional });
//Added the following to try to fix issue
routes.MapRoute("Inspection", "{controller}/{action}/{id}", new { controller = "Inspection", action = "Index", id = UrlParameter.Optional });
编辑3: 在InspectionController.cs我有以下Index方法
// GET: Inspection
[HttpGet]
public ActionResult Index()
{
return View(new ActiveInspectionsViewModel());
}
编辑4:
这里是空白页打开(例如)
XXX - /检查/
xxx -/Inspection/
[To Parent Directory]
Edi t 5:
我认为越来越接近这个问题,我已经禁用了Directory Browsing,现在我得到了403错误,这真的很奇怪,因为我所有的其他Action链接工作(/ Employees,/ InspectionTemplates,/ Clients, /电子邮件,/ CompanyLevels)这是造成问题的正义/检查,我的网址是inspection.xxx.co.za它可以是造成问题的公园领域?
这是您的默认路线 - 或者您是否有其他路线? – MichaelLake
我只有一条路线,让我更新所有路线的问题 –
“检查”控制器中的“索引”操作方法签名是什么样的? –