how to route back to url using Request.Headers["Referer"].ToString() in asp.net core

C#
if(Request.Headers["Referer"] != null)
{
    ViewData["Reffer"] = Request.Headers["Referer"].ToString();
}@if(!string.IsNullOrWhiteSpace(ViewData["Reffer"]))
{
    <a href="@ViewData["Reffer"]">Return to client detail</a>
}
Source

Also in C#: