Since MVC version 4 it is not required to write src="@Url.Content("~...")"
. Razor understands tilde and we can simply write src="~..."
.
I mistakenly though Razor calls UrlHelper.Content()
behind the scenes where instance comes from WebViewPage.Url property.
Unfortunately Razor behaves elsewise: Content()
method is not get called.
As I substitute default pages' UrlHelper
with my own implementation, the results of calling Content()
and simply writing url with tilde differ. Therefore I need consistency.
How to override Razor's behavior for tilde?