AddFeatureFolders | Enable feature folders for MVC controllers | Model View Controller library
kandi X-RAY | AddFeatureFolders Summary
kandi X-RAY | AddFeatureFolders Summary
Enable feature folders for MVC controllers and views in ASP.NET Core
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AddFeatureFolders
AddFeatureFolders Key Features
AddFeatureFolders Examples and Code Snippets
Community Discussions
Trending Discussions on AddFeatureFolders
QUESTION
I am writing a frontend/backend application. The frontend is an Angular 13 application. The backend is a combination backend API and administration web site. The backend has:
- Local Identity (including Identity scaffolding),
- Web API (for Angular frontend using Swagger bearer tokens),
- MVC view/controllers for side table administration.
The frontend needs to access API services. Login returns a token. The token is used to access the various services to maintain the application tables.
The backend .net 5 Core website reads and writes to a local SQL Server database. The database contains the Identity tables. The backend is also used to maintain the Identity tables using the scaffolding Razor pages. The backend maintains (basic CRUD) for a number of administrative tables. So, a user or an administrator logons via the scaffolding logon form using the same logon account that is used for the Angular frontend.
The problem is the login via PasswordSignInAsync is successful but User.Identity.IsAuthenticated is false. I use User.Identity in lots of places for name, roles and IsAuthenticated. I got a sense that User.Identity is supposed to happen automatically when using cookie authentication scheme. I added dual schemes, but that has not solved the problem. I have read through a number of questions per PasswordSignInAsync not working, but none seemed to help. The things I tried to solve the problem may have adversely affecting the outcome. I have read the source code of CheckPasswordSignInAsync and I do not see any setting of User.Identity. Not knowing what to do to get beyond this issue.
Please feel free to ask for any clarifications.
I’m showing my complete Startup.cs.
...ANSWER
Answered 2021-Dec-24 at 16:35After starting from ground zero, I feel I found the problem. I am now getting logon via Swagger API service (Angular 13) and the logon.cshtml Identity Razor scaffolding page.
When one properly adds the Identity scaffolding, one needs to change/review the IdentityHostingStartup.cs file. My updated IdentityHostingStartup is as follows:
QUESTION
I am trying to write an integration test for a controller with a view. I do it as part of migration to .Net Core 3.1 from 2.2. There is a lot of configuration in ConfigureServices
that we need to mock or disable in the tests, so, we derive from existing Startup
class and override the parts needed.
Now, I can make it working in .Net Core 3.1 using WebApplicationFactory
and overriding ConfigureWebHost
. However, I rather hoped to not rewrite the existing class that derives from Startup
.
I tried to use the approach from https://gunnarpeipman.com/aspnet-core-integration-test-startup/ where I specify the derived Startup
for WebApplicationFactory
and call UseSolutionRelativeContentRoot
(which has UseContentRoot
inside which I also tried). However, the views cannot be found. Part of the exception returned is:
ANSWER
Answered 2020-Feb-10 at 09:17To fix the problem into WithWebHostBuilder
I added
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AddFeatureFolders
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page