Category "asp.net-core"

IList returning count=0 on posting back updated checkboxes

I'm using asp.net-core with razor pages. I'm trying to update the checkboxes in the table. When clicking on button save I pass with asp-route-for because I wan

ASP.NET Core fails to load assemblies after migration from .NET 5 to 6.0.1

Recently, I upgraded our ASP.NET Core Web API project from .NET 5 to .NET 6.0.1. It was initially developed in .NET 5, but since this version is EOL somewhere t

Uncaught SyntaxError: Invalid regular expression [intlTelInput]

I am trying to use intl-tel-input in Asp.net core 6.0 razor pages Here is my Scripts $(document).ready(function(){ $('#tbxPhone').intlTelInput();

How to check radiobutton with Enum value in Asp.net core mvc view?

I have rendered my view like below <div class="row row-margin-zero"> <label class="radio-inline margin-rightt-ten margin-leftt-five margin-top-none

.Net Core 3.1 - Set ForContext for Serilog with Microsoft Ilogger interface

How to dynamically set ForContext property for Serilog logger using Ilogger interface from Microsoft.Extensions.Logging? Here's the code: private readonly ILogg

.NET core - Configure JWT Authentication at runtime

I have an ASP.NET Core 2 Web Application and I am using the [Authorize] attribute on the controllers that require authentication. As authentication mechanism, I

The constraint reference 'string' could not be resolved to a type. (netcoreapp3.0)

I have got an error. This is my Startup class. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); } public void Confi

.Net Core 3.0 possible object cycle was detected which is not supported

I have 2 entities that are related as one to many public class Restaurant { public int RestaurantId {get;set;} public string Name {get;set;} public Li

Decrypt ".AspNetCore.Session" cookie in ASP.NET Core

In Asp.Net core, a cookie is created when you configure your app to app.UseSession(). By default the cookie is called ".AspNetCore.Session". Its value identifi

Issue: No 'Access-Control-Allow-Origin' header is present on the requested resource

My problem is that I can't access to GET method from my Angular app because of the issue: Access to XMLHttpRequest at 'https://localhost:44337...' from origin '

How to read request body in an asp.net core webapi controller?

I'm trying to read the request body in the OnActionExecuting method, but I always get null for the body. var request = context.HttpContext.Request; var stream =

Hiding Azure CDN url

Is there any way to hide the Azure CDN Url in the browser. We have developed the application using ASP.Net Core 2 with Angular 5, also is there any helper class

How to directly set response body to a file stream in ASP.NET Core middleware?

Sample code below to write a file stream to Response.Body in an ASP.NET Core middleware doesn't work (emits empty response): public Task Invoke(HttpContext con

Host ASP (.NET 6) in a Windows Service

I am currently hosting an ASP.NET (.NET 5) application in a Windows Service using WebHost and WebHostBuilder. .NET 6 introduced WebApplication and WebApplicatio

How to set json serializer settings in asp.net core 3?

json serializer settings for legacy asp.net core applications were set by adding AddMvc().AddJsonOptions(), but I don't use AddMvc() in asp.net core 3. So how c

onclick method not working in Blazor server-side razor component

I am building a sample razor component, and I can not get my button onclick method to fire. When I click the button nothing happens at all. I have even placed a

Blazor @attribute [Authorize] tag is not working

I have a working .NET Core 3.0 MVC website, using AzureAD for authentication, this all works fine. I have started to migrate some of the front-end pages to Blaz

Displaying website image testing vs. production

I am currently working on updating a .NET Core website which currently has image tags displaying from a URL like: <img src="https://page.website.com/images/

MQTTnet Connection Issue with HiveMQ Cloud

I am new to the MQTT world and I am trying to create a .Net 5.0 application that connects to a HiveMQ Cloud Broker. I have created a free broker and I am able t

split json response in Qt

I have created a Restful Web Service in ASP.NET and would like to use it in my own Qt project. I can post to and get the data from my Web Service in the SoapUi