这是ASP.NET Core 2.0应用程序的路由配置:
routes.MapRoute(
"auth",
"session/{action}",
new { controller = "Session" }
);
routes.MapRoute(
"operator",
"operator/{action}",
new { controller = "Operator", action = "Index" }
);
routes.MapRoute(
"default",
"{action=Index}/{id?}",
new { Controller = "Home" }
);
这里有一些页面标记(_LoginPartial.cshtml):
<div>
<a asp-route="auth" asp-route-action="SignIn" class="btn btn-default navbar-btn">
<span class="glyphicon glyphicon-log-in"></span> Sign in
</a>
<a asp-area="" asp-controller="Session" asp-action="SignUp" class="btn btn-default navbar-btn">
<span class="glyphicon glyphicon-edit"></span> Sign up
</a>
</div>
假设我使用此Url启动浏览器 - http://localhost/operator
。
我的登录链接呈现为 - https://localhost:44396/operator/session/signin
为什么不https://localhost:44396/session/signin?我怎样才能让他们'绝对'?我也尝试过:
<a asp-controller="Session" asp-action="SignIn" class="btn btn-default navbar-btn">
<span class="glyphicon glyphicon-log-in"></span> Sign in
</a>
我错过了什么?