Returns the current request id.
// For ASP.NET Framework public static string RequestId() // For ASP.NET Core public static string RequestId(this HttpContext httpContext)
A string identifying the current request.
Each time you call this method within the same request, you will get the same string.
Note that if you call the with your own request id, that doesn't mean the RequestId method from that point on returns your request id. RequestId always returns the same request id.
How the request id is found
This method first checks whether the current request is a log request from the jsnlog.js library. If it is, it returns the request id contained in the log request. This way, the request ids in the client side log requests match the request id of the original request to the server that loaded the page that is now sending those log requests.
If it is not a log request, this method comes up with a unique id for the current request.
If the method can't get the request id with the above means, it generates a random GUID.