简体   繁体   English

.NET Core 2.2无法访问Controller,但可以使用脚手架登录

[英].NET Core 2.2 Unable to reach Controller but scaffolded Login works

在此处输入图片说明

I am currently unable to reach my Account Controller. 我目前无法联系我的客户经理。 I am replacing the Scaffolded Identity Login due to certain reasons. 由于某些原因,我将替换脚手架身份登录。

The current path to my AccountController is Areas > Identity > Pages > Account > AccountController 我AccountController的当前路径是Areas> Identity> Pages> Account> AccountController

Previously it would be Areas > Identity > Pages > Account > Login 以前是Areas> Identity> Pages> Account> Login

This is the top of my AccountController 这是我的AccountController的顶部

[Area("Identity")]
[AllowAnonymous]
[TypeFilter(typeof(ValidateApplicationStatusFilter), Arguments = new object[] { ApplicationGlobals.DocumentStudio })]
public class AccountController : Controller

In my Startup.cs I have set the loginpath as this: 在我的Startup.cs中,我将登录路径设置为:

options.LoginPath = "/Identity/Account/Login";

I have tried to put a debugger on my Login function in the AccountController but it never hits. 我试图在AccountController的Login函数中放置调试器,但从未成功。 When I login now, it shows me a different login form that seems to be the default created by .net? 现在登录时,它显示了另一种登录表单,该表单似乎是.net创建的默认登录表单?

I found out what the issue was. 我发现了问题所在。

In Startup.cs, I was using 在Startup.cs中,我正在使用

services.AddDefaultIdentity

This somehow forced it to use the default login page. 这迫使它使用默认的登录页面。 When I changed it to 当我将其更改为

services.AddIdentity

It worked. 有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何按角色进行不同的登录ASP.NET Core 2.2 - How to do different login by roles ASP.NET Core 2.2 成功登录后,asp.net core 2.2重定向到登录 - asp.net core 2.2 redirects to login after successful sign in 传递给控制器​​的ASP.NET Core 2.2 id始终为0 - ASP.NET Core 2.2 id passed to controller is always 0 ASP.Net Core 3.1 脚手架的身份页面并未全部使用(即登录页面正常,注册页面不正常)......为什么? - ASP.Net Core 3.1 scaffolded Identity pages not all used (ie. Login page OK, Register page NOK)…why? 由于构造函数 ASP:NET Core,Controller 在其他项目中无法到达 Controller - Controller cannot reach Controller in other project because of constructor ASP:NET Core .NET Core 2.2 发布问题 - .NET Core 2.2 Publishing problems 在.Net Core 2.2中发送HTML - Send Html in .Net Core 2.2 ASP.NET Core 2.1文件上传表单未到达控制器 - ASP.NET Core 2.1 File Upload Form doesn't reach controller Asp .net核心项目:Ajax调用无法到达控制器(400状态代码) - Asp .net core project: Ajax call can't reach controller (400 status code) ASP.NET 核心标识 UserManager.IsInRole 调用在 2.2 中有效,但在 3.0 中抛出 InvalidOperation - ASP.NET Core Identity UserManager.IsInRole Call Works in 2.2 But Throws InvalidOperation in 3.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM