Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

.net 6: How to get URL without Request Object [duplicate]

$
0
0

I am currently trying to upgrade a logging lib from framework 4.8 to .net 6.We have the following lines of code

if (isWebApplication){    _URI = System.Web.HttpContext.Current.Request.ServerVariables["URL"];}else{    _URI = My.Computer.Info.OSFullName;}                       

which I am struggeling to get working again since the System.Web.HttpContext does not exist in this form anymore.The only way to get the URL is form an existing request object, but since the logging lib should not care if it is used in a web or desktop app, I cant expect a HttpRequest object.

Are there any other generic ways to solve this?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



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