When loading Scripts, I tend to use a custom helper instead.
The code below does this, and has an additional boolean parameter that can be used when the script is not local to your applicaiton, and on a CDN for instance.
public static MvcHtmlString Script(this HtmlHelper helper, string src, bool local = true)
{
if (local) {
src = VirtualPathUtility.ToAbsolute("~/Scripts/" + src);
}
TagBuilder builder = new TagBuilder("script");
builder.MergeAttribute("src", src);
builder.MergeAttribute("type", "text/javascript");
return MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal));
}
You can then call the helper in your view like this:
<%: Html.Script("jquery.validate.min.js") %>
or:
<%: Html.Script("http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.js", false) %>