using System;
using System.Web;
using System.Web.Mvc;
namespace HelloWorldMvcApp
{
public static class UrlExtensions
public static string AbsoluteContent(this UrlHelper urlHelper, string contentPath)
// Build a URI for the requested path
var url = new Uri(HttpContext.Current.Request.Url, urlHelper.Content(contentPath));
// Return the absolute UrI
return url.AbsoluteUri;
}
using System.Collections.Generic;
public class HomeController : Controller
[HttpGet]
public ActionResult Index()
return Content(Url.AbsoluteContent("~/Home/Index"));