ASP.NET Core 2 Equivalent of Request.Servervariables

2.7k views Asked by At

This is a little annoying thing. Definitely not a show stopper. What is the equivalent of Request.ServerVariables?
Specifically, I would like to know how I get the current URL?

I have previously done this by getting Request.ServerVariables["script_name"]. I hate hard-coding text into a program, and I am finding that I would need to get the URL of the current page. I'd like to get the current URL of the running razor page, but I can't figure out why. Does anyone else know how to get the current URL in the current page?

0

There are 0 answers