Adding a correlation identifier to responses

Not all application errors will result in an error response — there are times when the application logic has a bug that results in a successful response but with the wrong values. In those cases, you need to have some way to correlate between the response the user received and the log events in your system. This is the purpose of the correlation identifier (or CorrelationID). 

The CorrelationID is a value that you create when a request is received, which you use whenever you write a log event. When the request handling is done, you attach the CorrelationID to the response, usually as a header, to allow the user to communicate it back to you if needed. You can even enhance this technique and send ...

Get Hands-On Full-Stack Web Development with ASP.NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.