I’m following a blog tutorial to implement the jQuery-plugin called FullCalendar, into an ASP.NET-project.
In that tutorial, they claim the following:
Url.Content method creates correct URL-s and it is way better than MS strategy (href like ….\Content\Site.css).
But they don’t even attempt to explain how they’ve come to that conclusion.
So what’s the difference between this:
<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
and this:
<script src="<%= Url.Content("~/Scripts/jquery-1.4.1.js") %>" type="text/javascript"></script>
"~/Scripts/jquery-1.4.1.js"That above will not resolve to a url since
~/doesn’t mean anything to the browser"<%=Url.Content("~/Scripts/jquery-1.4.1.js") %>"Url.Contentwill resolve the path of the url specified after~/in your applicationUrlHelper.Content Method
http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.content(v=vs.108).aspx