Skip to content
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
@Daniel15

Description

@Daniel15

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 Url.Content("~/"). It's a subtle difference, but it appears that older versions just check that the first character is "", whereas newer versions check that the string starts with "~/" (ie. it contains a tilde and a slash)

Old code:

bool isAppRelative = contentPath[0] == '~';

New code:

if (path.StartsWith("~/", StringComparison.Ordinal))

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions