I want to get the current URL into a string that I can use for e.g. share functionality later.
String strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery;
I get the error:
The name
HttpContext
does not exist in the current context.
Is there another way?
In case you are using MVC 3 or higher: Here is a related questions.
In case you are using ASP .Net MVC Core 1.0 you should use this code:
Context.Request.Path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With