Category "asp.net-core"

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

What is default maximum request length in .net core

I want to know what is default maximum request length in a .net core application. I read from few links that the default limit is 4 MB for asp.net applications

C# Razor partial view using an iFrame returns dictionary error "`1" and "`2"

I am attempting to load a partial view into an iFrame and receiving the below error. When loading the same partial not inside of a iFrame, there is no issue. Lo

Why can't I add months to OffsetDateTime?

I'm using NodaTime to manage dates and time zones in a .Net Core WebApi. One of the type in the library is OffsetDateTime, which is very similar to DateTimeOffs

React + ASP.Net-Core CORS Problems

While CORS is a big issue when working ReactJS in combination with ASP.Net-Core I figured out how to enable CORS so when accessing my UI (http://localhost:3000)

Why does an application pool for ASP.NET Core in IIS take a long time to stop?

I developed a simple demo web app using ASP.NET Core 5 and published in IIS. However, it takes a long time (over 30 seconds) when I press application pool stop

Disable verbose logging of symbol loading in vscode debug console

When running my webapp (in vscode), the debug console is filled with lines like these: Loaded '/foo/bar/dotnet/shared/Microsoft.NETCore.App/2.2.4/System.Pri

Differences between Microsoft.AspNetCore.Mvc.Testing and Microsoft.AspNetCore.TestHost packages

I have used several times the package Microsoft.AspNetCore.TestHost to host Asp.Net Core Web API applications in my integration test. With Asp.Net Core 2.1 the

Asp.Net Core http requests shows Headers.ContentLength

I am doing an http get call and I can see that Headers.ContentLength always returns null whereas I can see that in fiddler a value: This is my code string url =

An exception was thrown while deserializing the token.The antiforgery token could not be decrypted in .Net Core 2.2 application

I am getting the error in my log. I spent most of my day finding the solution but could not find the one which meets my requirement. Here is the log error seve

ASP.NET Core MVC app can't find error page?

I have an ASP.NET Core 3.1 MVC applications (not a Razor Pages project) and I'm trying to use the exception handling middleware via app.UseExceptionHandle("/err

How to fill attribute value from database on Razor Pages .netCore

I have an attribute above the action Method, the value of which must be filled from the database But I do not know how to do this I want to use this attribute i

ServiceFilter and TypeFilter - what is the difference in injection those filters?

ServiceFilter we must register in Startup.cs. TypeFilter is injected by Microsoft.Extensions.DependencyInjection.ObjectFactory, we don't need to register that f