asp.net-core-3.0

Create shorter tokens with small lifespan in ASP.NET Core Identity

寵の児 提交于 2021-02-08 07:19:27
问题 Using ASP.NET Core 3.1 I am creating an User's Email confirmation token to send by email: String token = await _userManager.GenerateEmailConfirmationTokenAsync(user); And I get the following: CfDJ8IjJLi0iO61KsS5NTyS4wJkSvCyzEDUBaVlXCkbxz6zwI1LocG8+WPubx5Rvoi4tFuiWAVFut4gfTnhgsdihE0gY+o7JyJrNtfXmzGLnczwbKZ3Wwy15+IUEi1h2qId72IRKvFqBSFv7rJdECSR/thZphpTQm7EnOuAA7loHlQFRWuMUVBce8HUsv1odbLNsKQ== How can I create shorter tokens with a small lifespan instead of huge tokens? 回答1: If I understand the

ASP.NET Core 3.0 Identity Server 4 (4.0.0) SecurityTokenInvalidAudienceException: IDX10214: Audience validation failed. Audiences: 'empty'

断了今生、忘了曾经 提交于 2021-02-07 08:22:04
问题 I keep getting the following error between postman and IdentityServer 4 Microsoft.IdentityModel.Tokens.SecurityTokenInvalidAudienceException: IDX10214: Audience validation failed. Audiences: 'empty'. Did not match: validationParameters.ValidAudience: 'MyNumberV2Api' or validationParameters.ValidAudiences: 'null'. at Microsoft.IdentityModel.Tokens.Validators.ValidateAudience(IEnumerable`1 audiences, SecurityToken securityToken, TokenValidationParameters validationParameters) at System

Fail OmniSharp MSBuild ProjectManager [duplicate]

时光怂恿深爱的人放手 提交于 2021-01-29 17:30:50
问题 This question already has answers here : OmniSharp.MSBuild.ProjectManager Failed to load project on Linux (3 answers) Closed 16 days ago . Note: I already search other similar question related to OmniSharp issue, could not find proper solution.Intellisense of vs code c# not working. I uninstall the c# extension and install again but it can not resolve my issue.I also install previous version of csharp 1.15.2 but it does not work. I attach my log info My dotnet --info is as follow .NET Core

Identity server does not redirect after sucessfull login

夙愿已清 提交于 2021-01-28 01:46:13
问题 I am trying to set up IdentityServer4 with MVC client. Everything works fine until I want to add ASP Identity. When I added code to use SQL server and Identity, after sucessfull login Identity server does not redirects me back to my client, but it just "refreshes" the page. IdentityServer app startup: public class Startup { public IWebHostEnvironment Environment { get; } public IConfiguration Configuration { get; } public Startup(IWebHostEnvironment environment, IConfiguration configuration)

Reading static files in ASP.NET Blazor

一曲冷凌霜 提交于 2021-01-27 12:21:53
问题 I have a client side Blazor Application. I want to have an appsetting.json file for my client-side configuration like we have an environment.ts in Angular. For that, I am keeping a ConfigFiles folder under wwwroot and a JSON file inside of it. I am trying to read this file as below. First get the path: public static class ConfigFiles { public static string GetPath(string fileName) { return Path.Combine("ConfigFiles", fileName); } } Than read it: public string GetBaseUrl() { string T = string

Reading static files in ASP.NET Blazor

拥有回忆 提交于 2021-01-27 12:21:02
问题 I have a client side Blazor Application. I want to have an appsetting.json file for my client-side configuration like we have an environment.ts in Angular. For that, I am keeping a ConfigFiles folder under wwwroot and a JSON file inside of it. I am trying to read this file as below. First get the path: public static class ConfigFiles { public static string GetPath(string fileName) { return Path.Combine("ConfigFiles", fileName); } } Than read it: public string GetBaseUrl() { string T = string

How to use both Blazor client and server in same web

喜你入骨 提交于 2021-01-20 08:14:39
问题 I'm learning about the Blazor , and see benefit of 2 types client-side and server-side . I want to use both on the same web e.g. one path is a client-side WebAssembly app, another path is a server-side that run code in server. I have seen Blazor Full-Stack template (not quite understand) but it missing from latest templates package. Did they remove it on purpose? (only 2 left Blazor Server App and Blazor WebAssembly App ) I download templates from this command. dotnet new -i Microsoft

Is there a robust way to register dependencies in ASP.NET Core 3.1 beside adding everything into Startup class?

大城市里の小女人 提交于 2021-01-18 03:53:38
问题 I have an ASP.NET Core 3.1 project. Typically, I register any dependency using the ConfigureServices() method in the Startup.cs class. But, I find myself having to register lots of dependencies and the ConfigureServices() looks huge! I know I can probably create an extension method of a static method and call it from the ConfigureService()` class, but wondering if there is a better way. If there a way to register dependencies in the IoC container without having to define them one at a time

Is there a robust way to register dependencies in ASP.NET Core 3.1 beside adding everything into Startup class?

这一生的挚爱 提交于 2021-01-18 03:52:19
问题 I have an ASP.NET Core 3.1 project. Typically, I register any dependency using the ConfigureServices() method in the Startup.cs class. But, I find myself having to register lots of dependencies and the ConfigureServices() looks huge! I know I can probably create an extension method of a static method and call it from the ConfigureService()` class, but wondering if there is a better way. If there a way to register dependencies in the IoC container without having to define them one at a time

Angular select value string parsing to integer

戏子无情 提交于 2021-01-07 03:45:38
问题 I am trying to fetch selected value from angular select control to an Asp.net Core 3.0 WebApi. when i debugged i found that, the selected value is in string format, but my data model accept integer. I am getting following error The JSON value could not be converted to System.Int32. Path: $.bankID | LineNumber: 0 | BytePositionInLine: 77. is there a simple way to cast the string value from select control to integer. Angular code Component.ts export class BankAccountComponent implements OnInit