ASP.NET Core 2.1 Identity: How to remove the Default UI razor pages?

Using the article linked by Panagiotis Kanavos, I was able to reach a solution. From the ASP.NET Core 2.1.0-preview1, there was a line .AddDefaultUI(), which you didn’t have to include in Startup.cs. services.AddIdentity<IdentityUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128) .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultUI() .AddDefaultTokenProviders(); In the final release version of Core 2.1 however, the same section was simplified … Read more

400 Bad Request when POST-ing to Razor Page

You are getting a 400 (Bad Request) response because the framework expects the RequestVerificationToken as part of the posted request.The framework uses this to prevent possible CSRF attacks. If your request does not have this information, the framework will return the 400 bad request. Your current code is not sending it. Change the code to … Read more

How to redirect on ASP.Net Core Razor Pages

You were very close. These methods need to return an IActionResult (or Task<IActionResult> for async methods) and then you need to return the redirect. public IActionResult OnGet() { string url = “/.auth/login/aad?post_login_redirect_url=” + Request.Query[“redirect_url”]; return Redirect(url); } Razor pages documentation However, you have a huge Open Redirect Attack because you aren’t validating the redirect_url variable. … Read more

.Net Core 3.0 JsonSerializer populate existing object

So assuming that Core 3 doesn’t support this out of the box, let’s try to work around this thing. So, what’s our problem? We want a method that overwrites some properties of an existing object with the ones from a json string. So our method will have a signature of: void PopulateObject<T>(T target, string jsonSource) … Read more

This version of Microsoft.AspNetCore.All is only compatible with the netcoreapp2.1 target framework

I had the same problem, but then I had not updated the publish profile file(.pubxml) for the right targetenvironment < TargetFramework>netcoreapp2.1< /TargetFramework> And regarding to earlier answer the row < DotNetCliToolReference Include=”Microsoft.EntityFrameworkCore.Tools.DotNet” Version=”2.0.1″ /> Show be removed in 2.1 version beacuse of obsolete and are included nowaday

Why is Razor Pages the recommended approach to create a Web UI in Asp.net Core?

From this article in Microsoft docs: MVC: Using controllers and views, it was common for applications to have very large controllers that worked with many different dependencies and view models and returned many different views. This resulted in a lot of complexity and often resulted in controllers that didn’t follow the Single Responsibility Principle or … Read more