How to get current url in view in asp.net core 1.0
You can use the extension method of Request
:
Request.GetDisplayUrl()
You need scheme, host, path and queryString
@string.Format("{0}://{1}{2}{3}", Context.Request.Scheme, Context.Request.Host, Context.Request.Path, Context.Request.QueryString)
or using new C#6 feature "String interpolation"
@($"{Context.Request.Scheme}://{Context.Request.Host}{Context.Request.Path}{Context.Request.QueryString}")
You have to get the host and path separately.
@Context.Request.Host
@Context.Request.Path