asp.net 5 mvc 6 loginUrl更改路径

编程入门 行业动态 更新时间:2024-10-28 04:28:50
本文介绍了asp 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更改路径

本文发布于:2023-11-12 13:51:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581680.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   net   asp   loginUrl   mvc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!