System.Web.VirtualPathUtility.ToAbsolute C# (CSharp) Method

ToAbsolute() public static method

public static ToAbsolute ( string contentPath ) : string
contentPath string
return string
        public static string ToAbsolute(string contentPath)
        {
            var context = Dependency.Resolve<IHttpContextAccessor>().HttpContext;
            return GenerateClientUrl(context.Request.PathBase, contentPath);
        }

Usage Example

 public void ToAbsolute8_b()
 {
     Assert.AreEqual("/blah2/", VPU.ToAbsolute("/blah1/../blah2/"));
     Assert.AreEqual("/blah2/", VPU.ToAbsolute("/blah1//../blah2/"));
     Assert.AreEqual("/blah2/", VPU.ToAbsolute("/blah1/\\../blah2/"));
     Assert.AreEqual("/blah2/", VPU.ToAbsolute("/blah1\\\\../blah2/"));
     Assert.AreEqual("/blah1/blah2/", VPU.ToAbsolute("/blah1/./blah2/"));
 }
All Usage Examples Of System.Web.VirtualPathUtility::ToAbsolute