更新时间:2023-12-01 15:26:28
您可以通过更改 web.config 上的 loginUrl
属性来做到这一点.将其更改为所需的路线:
You can do this by changing the loginUrl
attribute on your web.config. Change it to the desired route:
<authentication mode="Forms">
<forms loginUrl="~/Home/Index" timeout="2880" />
</authentication>
在 MVC6 中你可以试试这个(在 Startup.cs
中):
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookieAuthenticationOptions>(options =>
{
options.LoginPath = new PathString("/Home/Index");
});
}