Category "asp.net-core"

How to read web.config file in .Net Core app

I have created a .Net Core API and I referenced a .Net framework application to it. The referenced Application connects to a data base and its connection string

Net Core MemoryCache not resetting per request

.Net Core 3.0. I have a repo where IMemoryCache gets injected. Repo is registered as Transient. I would like for the cache to be cleared/reset PER request, howe

How Serilog posts to CloudWatch without any configuration setup?

I am migrating an app done in net core from Azure to AWS. Backend is an Asp.NetCore WebApi which uses Serilog for logging. I simply put it behind a subclass of

ASP.NET Core (.Net 6) Web Application throws System.NotSupportedException when run as a service. (Service will not start)

When I attempt to run my .Net Web Application as a Windows Service, it does not start. It works if I just run the executable but mysteriously fails when attempt

ArgumentNullException: String reference not set to an instance of a String. Parameter name: s System.Text.Encoding.GetBytes(string s)

I have this method to generate token: [HttpPost("login")] public async Task<IActionResult> login(UserForLoginDto userForLoginDto) {

Azure AD authentication, 404 not found on /signin-oidc

The past few days, I have gotten a 404 error on /signin-oidc after successfully authenticated with Azure AD against my ASP.NET Core web app using the Microsoft

Creating a (.NET 6 based) website project with ASP.NET Core and React (TypeScript) in Visual Studio 2022?

I have been trying to set up an ASP.NET Core + React (TypeScript) web app project in Visual Studio 2022, but couldn't succeed in doing so. There are no proper s

Pass parameter to Partial View in ASP.NET Core

On an ASP.NET Core 2.0 application I need to render a partial view and pass a few parameters: @Html.Partial("Form", new { File = "file.pdf" }) On the partial

How do I resolve Uncaught ReferenceError: signalR is not defined

@section scripts{ <script src="https://cdnjs.cloudflare.com/ajax/libs/microsoft-signalr/6.0.1/signalr.js"></script> } I added signalR CDN

In Blazor, how can I dynamically change an HTML tag?

Let's say I have the following markup in my Blazor component: <div @attributes=Attributes data-myattr="something"> @ChildContent </div> I'd lik

HTTP Verbs PUT and DELETE: 405 Method not allowed - how to allow?

I've been trying all the suggested workarounds for ASP.NET to be able to address my REST web service by HTTP Methods PUT and DELETE. However, none of them seems

API Gateway Ocelot .Net Core 6.1 Setup

The .Net 6 have removed the Start up Class and i am not able to find out how to configure Ocelot in new .Net 6 structure. I have found two methos using Ocelot.

How could I get a parameter of an action from the ResultExecutingContext when using a Filter

I'm creating a custom result filter that implements IAsyncResultFilter interface. In this filter I need the actual value returned by the Action, but I also need

System.Data.SqlClient.TdsParser' threw an exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format

I am hosting .net core applicaton on server but when I try to run the application it throws exception in windows logs: Unhandled exception. System.TypeInitializ

Get the value of /page/2 rather than using /page?id=2

I am using a razor page and want to get the value from the path. What is the correct way to do this using the razor page or do I have to parse the Http URL?

Will BackgroundService play nicely on a Kubernetes cluster

I have a kubernetes cluster into which I'm intending to implement a service in a pod - the service will accept a grpc request, start a long running process but

How to setup AutoMapper in ASP.Net Core 6

How to configure AutoMapper in ASP.Net Core 6 I have a project which is written in .Net 3.1 so we had Startup.cs class. I am migrating it to .net core 6 now whe

Hangfire Not Getting Configurations when I try to run Test Case for the method containing hangfire activation .net Core REST Web API

public async Task<IActionResult> SendOrders() { try { RecurringJob.AddOrUpdate("powerfuljob", () => _lab.SendOrders("

Should I use Request-Id, X-Request-Id or X-Correlation-Id in the request header?

I am not clear which id header I should put in the request and response for the correlationship purpose. "X-Correlation-ID" and the "X-Request-ID" are the know

Calling Another Project's Controller From A Project In The Same Solution (.NET Core )

There are 2 projects in the same solution. First project is a .NET Core project and it has all the codes(controllers, models etc.) related to packages. I need t