Log Request and Response Details of your Actions in ASP.NET Core.
You can add your desired details like UserAgent info (such as browser, os, ... details) in
LogRequestAttribute.OnActionExecuting
Just put [LogRequest]
attribute on your actions or register it globally
public class HomeController : Controller
{
public HomeController()
{
}
[LogRequest]
public IActionResult Index(MyViewModel myViewModel)
{
return View();
}
[LogRequest]
public IActionResult Privacy()
{
throw new Exception("test");
return View();
}
}
Check out Program.cs
and Startup.cs
to see how to Configuration.
This uses Serilog and Serilog.AspNetCore for logging and MSSqlServer sink but you can use any other Sinks.
Simple Serilog log viewer UI for several sinks.
Home for C# .NET developers! ❤ Let's build web sites, PWA, android, iOS and Windows apps using bit platform!
List of awesome tips and tricks, resources, videos and articles in .net, software architecture, microservice and cloud-native
See server-side reports inside browser console
Lightweight and Extensible Infrastructure for Building Web Applications - Web Application Framework
Dynamic Permission Samples in ASP.NET Core and ASP.NET MVC 5.
Professional REST API design with ASP.NET Core WebAPI
SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data).