.Net Core Request Question

beantownace

Active member
Joined
Feb 15, 2019
Messages
26
Programming Experience
5-10
Hello all,

Question I have is there anyway to be able to run a method for every request coming in per request to check a parameter and if that parameter exists I would run this login code I have then after the request or any error logoff method I have.

I was just curious if somehow through the startup someway etc. be able to run this for every request coming in. The requests coming in have a FromBody all posts with one of two common objects.

Thanks all just curious if something existed like that based on a scenario I am dealing with.
 
Please provide a FULL and CLEAR explanation of the problem. It appears that this is an ASP.NET Core MVC application but that is not something that we should have to piece together for ourselves from clues throughout the question.

Assuming that is the case, all your controllers inherit the Microsoft.AspNetCore.Mvc.Controller class. Instead, you can create your own base class that inherits that Controller class and then have all your controllers inherit your own class instead. In that common base class, you can override one or more of the OnActionExecuting, OnActionExecuted and OnActionExecutionAsync methods to execute code every time an action is executed.
 
No this has nothing to do with ASP.Net MVC I am talking about .Net Core
You do know that the two are not mutually exclusive, right? .NET Core is a target platform but the application still has to be based on a specific technology. Is it a Console app? Windows Forms? WPF? ASP.NET MVC? ASP.NET Web API? Something else? You haven't specified any technology so you force us to guess. According to you, I have guessed wrong, which rather makes my point for me. If you're using FromBody then I'm fairly sure that it must be an ASP.NET app of some sort, but the question is which. I think that it has to be MVC or Web API, but I'm not 100% sure about that. I shouldn't have do all this to work out how to help you though. Like I said, you need to provide a FULL and CLEAR explanation of the problem. You need to tell us what type of application it is so, if you don't know, you need to find out. The steps to create the project in the first place would identify the type of application. You should also specify the version of .NET Core because things change between versions so the most appropriate advice might have to change too.
 
.NET Core is not just for web apps.
 
Yes.
 
Back
Top Bottom