This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Inconsistency with Url.Content("~") #2896
Closed
Description
In previous versions of ASP.NET MVC, Url.Content("~")
returns the application's root directory (ie. /foo
). On ASP.NET MVC 6, this just returns a verbatim "", and you need to actually use ", whereas newer versions check that the string starts with "~/" (ie. it contains a tilde and a slash)Url.Content("~/")
. It's a subtle difference, but it appears that older versions just check that the first character is "
bool isAppRelative = contentPath[0] == '~';
if (path.StartsWith("~/", StringComparison.Ordinal))