Issue in ASP.NET MVC app during urls generation with UrlHelper.GenerateContentUrl/Url.Content when UrlRewrite is configured to rewrite links not redirect.
when I use UrlRewrite with url rewrite from public /seo-friendly-name-url to server /Home/Index/123, for instance, I get this error due the logic in code lines: 106, 107, 108
System.Web.HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.
at System.Web.Util.UrlPath.ReduceVirtualPath(String path)
at System.Web.Util.UrlPath.Reduce(String path)
at System.Web.VirtualPath.Combine(VirtualPath relativePath)
at System.Web.VirtualPathUtility.Combine(String basePath, String relativePath)
at System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath)
at System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath)
at System.Web.WebPages.UrlUtil.GenerateClientUrl(HttpContextBase httpContext, String basePath, String path, Object[] pathParts)
https://github.com/aspnet/AspNetWebStack/blob/39d3064baf13181f5718ec5d85ba644b47d0704b/src/System.Web.WebPages/Utils/UrlUtil.cs#L108
Issue in ASP.NET MVC app during urls generation with UrlHelper.GenerateContentUrl/Url.Content when UrlRewrite is configured to rewrite links not redirect. when I use UrlRewrite with url rewrite from public /seo-friendly-name-url to server /Home/Index/123, for instance, I get this error due the logic in code lines: 106, 107, 108
There is workaround I posted at stackoverflow: https://stackoverflow.com/a/53852932/1487713
My full stack trace: