Category "asp.net-core"

Getting an invalidcastexception when trying to retrieve data

When running the get method to return a view populated with details, I get the exception saying: System.InvalidCastException: 'Unable to cast object of type 'Sy

The specified CGI application encountered an error and the server terminated the process. - timeout issue

Getting below error for API which takes around 2-4 minute to process Code:502 Error: Bad Gateway The specified CGI application encountered an error and the serv

How does cascaded parameter Task<AthenticationState> get unwrapped and exposed as "context" in AuthorizeView and AuthorizedRouteView in Blazor WASM?

There is a an object of type AuthenticationState named "context" that is available inside AuthorizeView and AuthorizedRouteView components. This object allows t

How do I use .Net Core Dependency Injection from within a custom Class

Bit of a newbie question. I am having trouble getting access to dependency injected services from within my own custom class in ASP.NET Core 3.1 I can access se

ASP.NET Core Identity prevent user from using same password

I have a project where I am using ASP.NET Core Identity (with IdentityServer4) for user authentication. When I use ChangePasswordAsync to change password, it is

Is there a way in Fluent Validation library to remove the index from the collection validation errors?

I'm using Fluent Validation to validate this model: class MyModel { public int Id {get; set;} public List<ChildModel> Children {get; set;} } clas

Setting up IActionDescriptorCollectionProvider for a unit test

I am currently writing unit tests for a TagHelper that uses IActionDescriptorCollectionProvider in its constructor. My setupt looks as below so far - any ideas

Tag helper order of execution

I am writing a set of ASP.Net Core tag helpers that target (among other tags) <form> and <input> tags. My <form> tag helper defines a custom a

how do you set same error message for all required attribute validation?

I am new to .net core. The following code changes all required validation message to "This field is required" for asp.net framework. public class CustomRequir

How to read appsettings.json in xunit test project?

I am trying to write the test cases for one of the method written in MVC controller and in that method I am reading AppSettings.json file. as below public class

ASP.NET Core Web API CORS error on Firefox but okay on Chrome

I have a React and ASP.NET Core 2.2 SPA that has a CORS issue with Firefox but is okay in Chrome and Edge. I've created a little test rig that consists of the A

.NET Core Worker service host as a Windows Services (using Coravel for task scheduling)

I have created a worker service to schedule a task using Coravel is a .NET Standard library and it is working as expected. I want to host the same as a windows

Compilation error after publishing individual Razor page. Persists after publishing entire project. ("Compilation references may be missing")

Today I was working on a .NET Core 3.0 project (VS 2019). I added a CSS class to a <span> on one of my pages. That's it. Nothing else. I figured publishin

How to use HttpClientFactory with AutoRest generated client

AutoRest generated client don't have suitable constructor for use it with services.AddHttpClient() method. So how can we get around this? Now we have public co

Error "dotnet : Could not find any project in `C:\**." when running "dotnet add package Microsoft.AspNetCore.Authentication.MicrosoftAccount"

I have visual studio 2019 and i created a new asp.net core 2.2 project. now i am following these steps Configure Microsoft Account Authentication to enable exte

Move Identity Tables To Custom Schema Asp.Net Core

I Try To move all my identity Tables to Schema "User" using the following code in my context. it works fine for all except "AspNetUserClaims", "AspNetRoleClaims

How do I setup tnsnames.ora in asp.net core web application?

I have a small asp.net core 2.2 app that should access an oracle db; I'm using NuGet Oracle.ManagedDataAccess.Core (2.18.6), and it just works on my machine. W

Why is static Configuration.GetSection() not available?

In my ASP.NET Core 3.1 project I am trying to read a configuration option from "appsettings.json" via dependency injection service container just as explained b

This site can’t provide a secure connection asp.net core from dotnet linux

I am currently developing an API using asp.net core 2.1. When I use the ide visual studio 2019 in windows I don't have problems running the project, but now I

Issue restoring local NuGet package through Azure Pipelines

I have come across an issue in Azure Pipelines where I have a local NuGet package in my repo that I wish to include in the pipelines build alongside all other N