我的项目有问题。登录成功后返回重定向页面时。我的期望链接是:/Admin/Subject/Index.cshtml
。但是在调试时,URL为:/Subject/Index.cshtml?Area="Admin"
,但出现404错误。
return RedirectToRoute(new
{
Areas = "Admin",
controller = "Subject",
action = "Index"
});
// And
return RedirectToAction("Subject", "Courses", new { areas="Admin"});
这是我的RouteConfig
app.UseMvc(routes =>
{
routes.MapRoute(name: "MyArea",
template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(name: "default",
template: "{controller=Main}/{action=Login}/{id?}");
});
我在做什么错了?