asp.net 5 mvc 6 loginUrl更改路径 [英] asp.net 5 mvc 6 loginUrl change path

查看:81
本文介绍了asp.net 5 mvc 6 loginUrl更改路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS 2015 WebApplication中创建新项目时,如何在未经授权的情况下更改重定向LoginUrl路径?

When creating a new project in VS 2015 WebApplication, how would you go about changing the Redirect LoginUrl Path when not Authorize'd?

我创建了一个新区域,在其中创建了一个loginController.此loginController要求您经过授权.但是,当尝试访问页面时,我被重定向到"/Account/Login".

I have created a new Area, where I have created a loginController. This loginController requires you are Authorize'd. But when trying to reach the pages, I am redirected to "/Account/Login".

如何将这个路径更改为"/AREA/Login/Index"?

How would I go about changing this path to "/AREA/Login/Index"?

推荐答案

尝试执行以下操作:

services.Configure<CookieAuthenticationOptions>(options =>
{
    options.LoginPath = new PathString("/<YOUR-AREA>/Account/Login");
});

问题:您是否使用[Area]属性装饰了控制器?

Question: Did you decorate your controller with an [Area] attribute?

这篇关于asp.net 5 mvc 6 loginUrl更改路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆