Hi,
I am developing an ASP.NET 6 website and I am decomposing the current URL on the browser. To get the current URL I am using the following C# instruction:
Uri address = new Uri(Request.Host.ToString());
I see that Request is a method of ControllerBase and the result is of type HttpRequest. Watching Microsoft documentation, it seems to me that this was designed for .NET Framework 4.8 (and below) but I am not sure.
Doing a bit more of research, I found the HttpWebRequest class that might do the job of what I need but Microsoft documentation says this is not recommended for new development and that System.Net.Http.HttpClient should be considered but after going over the HttpClient documentation I do not see how to get the current URL in the browser.
I will very much appreciate your feedback on my issue so I can get the current URL on the browser in the best possible way.
Respectfully,
Jorge Maldonado