Click here to Skip to main content
15,886,736 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have needed to LOG any action perform by user. like: which routes he visit, button click, etc...
Also, log the DateTime or visit routes.

What I have tried:

Handle requests with controllers in ASP.NET Core MVC | Microsoft Docs[^]
Posted
Updated 25-Aug-19 14:06pm
v2

You are handling that with .NET Core or .NET framework? There are differences in how you might handle the requests and responses in both these frameworks. Since you already have tried something for .NET Core,
Quote:
which routes he visit
This part of your application can be handled within the ASP.NET MVC, check out this thread for more on that, ASP.NET MVC 4 intercept all incoming requests - Stack Overflow[^]
Quote:
button click,
Now this part has to be handled from outside, and installation of plugins such as Application Insights and Google Analytics and they can handle the front-end event logging.

Google Analytics[^]
What is Azure Application Insights? | Microsoft Docs[^]

My personal recommendation is Application Insights, as it provides an amazing set of dashboard and reporting tools too.
 
Share this answer
 
v2
One option that can be used to automatically log those request/response is via middleware in .Net Core. An example implementation is available at Using Middleware to Log Requests and Responses in ASP.NET Core - Exception Not Found[^] .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900