public static System.Web.Mvc.MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false) { if (ResourceHelper.TryConfigureScriptManager(scriptReference)) { return(System.Web.Mvc.MvcHtmlString.Empty); } var resourceKey = scriptReference.ToString(); var context = helper.ViewContext.HttpContext; var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference); if (string.IsNullOrEmpty(resourceUrl)) { return(System.Web.Mvc.MvcHtmlString.Empty); } return(ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException)); }
public static MvcHtmlString Script(this HtmlHelper helper, ScriptRef scriptReference, bool throwException = false) { if (ResourceHelper.TryConfigureScriptManager(scriptReference)) { return(MvcHtmlString.Empty); } var resourceKey = scriptReference.ToString(); var context = helper.ViewContext.HttpContext; var resourceUrl = ResourceHelper.GetWebResourceUrl(scriptReference); if (string.IsNullOrEmpty(resourceUrl)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Script reference for {0} is not found.", resourceKey)); } return(ResourceHelper.RegisterResource(context, resourceKey, resourceUrl, throwException)); }