Quantcast
Viewing latest article 24
Browse Latest Browse All 44

Is there a benefit to using @Url.Content("~")

I'm new to MVC4/razor2, and I think understand the general benefit of using @Url.Content and @Url.Action- if my routing or virtual directory changes, magic-url-strings are correctly rendered.

I'm looking at some legacy Javascript-with-razor code in a view that is peppered with '@Url.Content("~")'. This renders out as '/' - or, website root. Which.... would always be the case, no?

Or is there some situation in which this could be rendered differently?

Note: it is not~/ - just plain ol' tilde.


I'm planning on extracting the razor calls to helper-functions, and moving main block of JavaScript into an external file (for linting and general "cleanliness"). I don't need to "fix" anything that currently happening, but I would like to understand it better.


Viewing latest article 24
Browse Latest Browse All 44

Trending Articles