Aspnetboilerplate:在核心mvc模板上配置用于重定向的登录路径 [英] Aspnetboilerplate: Configure login path for redirect on core mvc template
问题描述
很抱歉,如果这很简单,但是我对此有一个真正的认识.
Sorry if this is straightforward, but I'm having a real block with this one.
我正在尝试将所有标准视图和控制器从aspnetboilerplate的Module Zero(核心+ MVC + jQuery)移动到新区域(管理员),并希望确保未经授权的视图上的登录重定向转到/Admin/登录与/Account/Login(默认设置)相反.
I'm trying to move all the standard views and controllers from aspnetboilerplate's Module Zero (Core + MVC + jQuery) into a new area (Admin) and want to make sure the redirect for login on unauthorized view goes to /Admin/Login as opposed to /Account/Login, which is the default.
任何帮助都很感激.
戴尔
这是ConfigureServices
方法:
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//MVC
services.AddMvc(options =>
{
options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
});
IdentityRegistrar.Register(services);
AuthConfigurer.Configure(services, _appConfiguration);
services.ConfigureApplicationCookie(options => options.LoginPath = "/Admin/Login");
services.AddScoped<IWebResourceManager, WebResourceManager>();
//Configure Abp and Dependency Injection
return services.AddAbp<CrowdsiteWebMvcModule>(options =>
{
//Configure Log4Net logging
options.IocManager.IocContainer.AddFacility<LoggingFacility>(
f => f.UseAbpLog4Net().WithConfig("log4net.config")
);
});
}
推荐答案
您可以在
相关文档: https://docs.microsoft.com/zh-CN/aspnet/core/migration/1x-to-2x/identity-2x 这篇关于Aspnetboilerplate:在核心mvc模板上配置用于重定向的登录路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!