Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Instrumentation Profiler in CoreCLR(.Net Core) - Ways to get HttpContext in .NetStandard assembly

$
0
0

I am trying to Instrument .NET Core web applications that runs on .NET Core 3.1 using CoreCLR Profiler.
When I allow injecting the code into the Web application's method the helper assembly(.NET standard 2.0) is got attached to dotnet.exe process and it is getting callbacks to the helper assembly.
I have created helper assembly(.NET standard 2.0) with the injected functions body.

Now I need to get the HttpContext.Current of the each HTTP request of .NET core web application in helper assembly(.NET standard 2.0). In .Net framework we have System.Web.HttpContext.Current and System.Web.HttpRequest to get the Header,cookie,session id and site name of each request. How can I achieve same in .Net standard? 

1. Can I use Microsoft.AspNetCore.Http.HttpRequest in .NET standard 2.0 assembly? If so how can I add reference to .Net standard assembly?
2. How can I get Header,cookie,session id and site name of .net core web application in .NET standard 2.0 assembly?
3. What is the alternative/equivalent of following .Net Framework namespaces in .Net Core/.Net 
     A. System.Web.HttpContext.Current
     B. System.Web.HttpRequest
     C. System.Web.HttpCookie
     D. System.Web.Hosting.HostingEnvironment.SiteName

It would be much helpful if i get some correct direction to get or use HttpContext.Current in .NetStandard assembly.

Thanks in advance. 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>