In ASP.NET MVC how can I use the Razor @Url.Content() helper from C# code? April 22, 2023 by Tarik Use the following to mimic Url.Content in code. VirtualPathUtility.ToAbsolute("~/url/");