スキップしてメイン コンテンツに移動

投稿

ラベル(C#)が付いた投稿を表示しています

[ASP.NET Core 3.0] Sign in with Identity

Today I tried authentication by ASP.NET Core Identity. What I did 1. Create custom IdentityUser 2. Create a route for authentication 3. After authentication, access authorized route Setup Most of all environments were same as previous post. I only installed Microsoft.AspNetCore.Identity.EntityFrameworkCore (ver.3.0.0) by NuGet. Add user table I added user table to DB. CREATE TABLE "User" ( "UserId" serial PRIMARY KEY, "Name" text not null, "Password" text not null ) 1. Create custom IdentityUser First, I created custom IdentityUser for signing in. Because the default IdentityUser had had so many properties. But I only wanted three things below. Id UserName Password ApplicationUser I could created custom user class by inheritting IdentityUser class. ApplicationUser.cs using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.AspNetCore.Identity; names...

Upgrade from ASP.NET Core 2.2 to 3.0

Conguratulations on the releasing .NET Core 3.0 and ASP.NET Core 3.0! Today's theme is about upgrading ASP.NET Core from ver.2.2 to ver.3.0. What I did Creating an empty ASP.NET Core project(ver.2.2.402) Adding EntityFrameworkCore by NuGet Adding some codes Upgrading to ver.3.0.100 Fixing some problems Setup Environments .NET Core : ver.2.2.402, ver.3.0.100 Microsoft.EntityFrameworkCore : ver.2.2.6, ver.3.0.0 Npgsql.EntityFrameworkCore.PostgreSQL : ver.2.2.4, ver.3.0.1 Windows10 : ver.1903 Rider : ver.2019.2.3 PostgreSQL : ver.12.0 Creating the base project UpgradeSample.csproj <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include=...