public void UrlToAbsolutePath()
 {
     Assert.That(GeneralUtility.UrlToAbsolutePath("http://www.example.com/Path1/File.html"), Is.EqualTo("/Path1/File.html"), "Should be able to do full path");
     Assert.That(GeneralUtility.UrlToAbsolutePath("/Path1/File.html"), Is.EqualTo("/Path1/File.html"), "Should be able to do relative path");
     Assert.That(GeneralUtility.UrlToAbsolutePath("Path1/File.html"), Is.EqualTo("/Path1/File.html"), "Should be able to do relative path");
     Assert.That(GeneralUtility.UrlToAbsolutePath("File.html"), Is.EqualTo("/File.html"), "Should be able to do relative path");
 }
        private bool IsThisHttpRequestForTheErrorTemplatePage()
        {
            // Sometimes we get urls like: /Error/Error.aspx?500;http://example.com/Home.mvc/Error
            // That means the error template page got a secondary error, so we don't want to continue trying to load the error template page
            var errorUri  = new UriBuilder(Instance.ErrorUrl);
            var errorPath = errorUri.Path;

            if (Request.Url.PathAndQuery.Contains(errorPath, StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }

            var errorUrlAbsolutePath   = GeneralUtility.UrlToAbsolutePath(Instance.ErrorUrl);
            var potentialErrorUrlPaths = new List <string> {
                errorUrlAbsolutePath
            };
            var requestAbsolutePath = Request.Url.AbsolutePath;

            return(potentialErrorUrlPaths.Contains(requestAbsolutePath, StringComparer.InvariantCultureIgnoreCase));
        }