/// <summary> /// Get the application's root path in a safe and consistent manner. /// </summary> /// <returns> /// Returns the application's root path with a trailing slash /// appended. E.g. on a development machine it will return /// http://localhost/mywebapp1/, and on a deployment machine it will return /// something like http://www.mysite.com/. /// </returns> public static String GetApplicationPath() { return (Uri.UriSchemeHttp + Uri.SchemeDelimiter + HttpContext.Current.Request.Headers["Host"].ToLower() + HttpContext.Current.Response.ApplyAppPathModifier( StringUtils.AddTrailingForwardSlash(HttpContext.Current.Request.ApplicationPath.Trim()))); }