using System.Web; namespace DR.FV2016.Web.Mvc { public static class UrlHelpers { public static string GetCurrentRelativePath() { // create an absolute path for the application root var appUrl = VirtualPathUtility.ToAbsolute("~/"); // remove the app path (exclude the last slash) return HttpContext.Current.Request.Url.AbsolutePath.Remove(0, appUrl.Length - 1); } } }