This was apparently always possible in .net core 1.0 with Microsoft.AspNetCore.Http.Extensions
, which adds extension to HttpRequest
to get full URL; GetEncodedUrl.
e.g. from razor view:
@using Microsoft.AspNetCore.Http.Extensions
...
<a href="@Context.Request.GetEncodedUrl()">Link to myself</a>
Since 2.0, also have relative path and query GetEncodedPathAndQuery.