public string GetFullAbsolutePath(string virtualPath) { if (string.IsNullOrEmpty(virtualPath)) { return(ServerRootPath); } if (virtualPath.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase) || virtualPath.StartsWith("mailto:", StringComparison.InvariantCultureIgnoreCase) || virtualPath.StartsWith("javascript:", StringComparison.InvariantCultureIgnoreCase) || virtualPath.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase)) { return(virtualPath); } if (string.IsNullOrEmpty(virtualPath) || virtualPath.StartsWith("/")) { return(ServerRootPath + virtualPath); } return(ServerRootPath + VirtualRoot.TrimEnd('/') + "/" + virtualPath.TrimStart('~', '/')); }