ASP.NET Core Dependency Injection Error: Multiple constructors accepting all given argument types have been found in type Collections.Generic.List

I am developing in ASP.NET Core 2.2 with Razor Pages. At the moment, I am attempting to display a simple list of countries that is being being loaded through a partial view using Ajax. When I click the button to execute the Ajax call, I get the error: InvalidOperationException: Multiple constructors accepting all given argument…

Add custom properties to ASP.net checkboxlist

Checkbox list items have default “Text”, “Value”, “Enabled” and “Selected” properties. I need to add an “ImageUrl” property to each item in my list. I use this code: foreach (Zone zn in ZonesList) { ListItem item = new ListItem(zn.Name, zn.Id.ToString()); item.Attributes.Add(“ImageUrl”, zn.Image ); item.Selected = false; visitPlaceList.Items.Add(item); } visitPlaceList.DataBind(); but it still doesn’t show any…

How To Store JWT Token In Cookie in ASP.NET Core 3 SPA App

I’ve got a default ASP.NET Core 3 app that I’ve built using the latest “create-react-app” template. that is, in the startup.cs, I have the following code that instantiates the JWT Token generator that I assume uses OpenID. I’ve created the React template, but I don’t think that matters in this case., services.AddDefaultIdentity<ApplicationUser>() .AddEntityFrameworkStores<ApplicationDbContext>(); services.AddIdentityServer() .AddApiAuthorization<ApplicationUser,…

Asp.net Core 3.0 CORS not working based on official documentation

I want to enable CORS with Asp.Net Core 3.0 API project. This is the basic generated Asp.Net Core Api template. Everything is default from the template, except I added CORS settings from the documentation: Enable Cross-Origin Requests (CORS) in ASP.NET Core Here it is my Startup.cs public class Startup { public Startup(IConfiguration configuration) { Configuration…