How to get current url in view in asp.net core 1.0

oneNiceFriend picture oneNiceFriend · Jul 18, 2016 · Viewed 125.9k times · Source

In previous versions of asp.net, we could use

@Request.Url.AbsoluteUri

But it seems it's changed. How can we do that in asp.net core 1.0?

Answer

Clint B picture Clint B · Jul 18, 2016

You have to get the host and path separately.

 @[email protected]