{"id":2164,"date":"2012-09-21T02:08:00","date_gmt":"2012-09-21T02:08:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2012\/09\/21\/asp-net-4-5-scriptmanager-improvements-in-webforms\/"},"modified":"2022-08-10T06:16:31","modified_gmt":"2022-08-10T13:16:31","slug":"asp-net-4-5-scriptmanager-improvements-in-webforms","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/asp-net-4-5-scriptmanager-improvements-in-webforms\/","title":{"rendered":"ASP.NET 4.5 ScriptManager Improvements in WebForms"},"content":{"rendered":"<p>The ScriptManger control has undergone some key targeted changes in ASP.NET 4.5 which makes it easier to register, manage and combine scripts using the ASP.NET <a href=\"http:\/\/aspnetoptimization.codeplex.com\/\" target=\"_blank\" rel=\"noopener\">weboptimization<\/a> feature. This post will highlight the changes that have happened to this control<\/p>\n<h2>Easy Integration with JQuery and JQueryUI<\/h2>\n<p>The <a href=\"https:\/\/github.com\/rustd\/ASPNETTemplates\" target=\"_blank\" rel=\"noopener\">default templates<\/a> for WebForms ship with the following packages &ldquo;<strong><a href=\"http:\/\/nuget.org\/packages\/AspNet.ScriptManager.jQuery\" target=\"_blank\" rel=\"noopener\">AspNet.ScriptManager.jQuery<\/a><\/strong>&rdquo; and &ldquo;<strong><a href=\"http:\/\/nuget.org\/packages\/AspNet.ScriptManager.jQuery.UI.Combined\" target=\"_blank\" rel=\"noopener\">AspNet.ScriptManager.jQuery.UI.Combined<\/a><\/strong>&rdquo;. These packages make it easier to bring in jquery and jqueryUI libraries&nbsp; and also register them with the ScriptManager. Here is how it works.<\/p>\n<p>These packages add the following <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.web.ui.scriptmanager.scriptresourcemapping.aspx\" target=\"_blank\" rel=\"noopener\">ScriptMappings<\/a> for jquery and jqueryUI in the <a href=\"http:\/\/haacked.com\/archive\/2010\/05\/16\/three-hidden-extensibility-gems-in-asp-net-4.aspx\" target=\"_blank\" rel=\"noopener\">PreApplicationStart<\/a> method of the application<\/p>\n<h3>JQuery<\/h3>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\"><span style=\"color: #0000ff\">string<\/span> str = <span style=\"color: #006080\">\"1.7.1\"<\/span>;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    ScriptManager.ScriptResourceMapping.AddDefinition(<span style=\"color: #006080\">\"jquery\"<\/span>, <span style=\"color: #0000ff\">new<\/span> ScriptResourceDefinition<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        Path = <span style=\"color: #006080\">\"~\/Scripts\/jquery-\"<\/span> + str + <span style=\"color: #006080\">\".min.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        DebugPath = <span style=\"color: #006080\">\"~\/Scripts\/jquery-\"<\/span> + str + <span style=\"color: #006080\">\".js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnPath = <span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/jQuery\/jquery-\"<\/span> + str + <span style=\"color: #006080\">\".min.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        CdnDebugPath = <span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/jQuery\/jquery-\"<\/span> + str + <span style=\"color: #006080\">\".js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnSupportsSecureConnection = <span style=\"color: #0000ff\">true<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        LoadSuccessExpression = <span style=\"color: #0000ff\">\"window.jQuery\"<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    });<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<h3>JQuery.UI<\/h3>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\"><span style=\"color: #0000ff\">string<\/span> str = <span style=\"color: #006080\">\"1.8.20\"<\/span>;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    ScriptManager.ScriptResourceMapping.AddDefinition(<span style=\"color: #006080\">\"jquery.ui.combined\"<\/span>, <span style=\"color: #0000ff\">new<\/span> ScriptResourceDefinition<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        Path = <span style=\"color: #006080\">\"~\/Scripts\/jquery-ui-\"<\/span> + str + <span style=\"color: #006080\">\".min.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        DebugPath = <span style=\"color: #006080\">\"~\/Scripts\/jquery-ui-\"<\/span> + str + <span style=\"color: #006080\">\".js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnPath = <span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/jquery.ui\/\"<\/span> + str + <span style=\"color: #006080\">\"\/jquery-ui.min.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        CdnDebugPath = <span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/jquery.ui\/\"<\/span> + str + <span style=\"color: #006080\">\"\/jquery-ui.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnSupportsSecureConnection = <span style=\"color: #0000ff\">true<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    });<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>These SciptMappings are registered with ScriptManager as follows<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">&lt;asp:ScriptManager runat=<span style=\"color: #006080\">\"server\"<\/span>&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        &lt;Scripts&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"jquery\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"jquery.ui.combined\"<\/span> \/&gt;            <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        &lt;\/Scripts&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    &lt;\/asp:ScriptManager&gt;<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Now you can enjoy all the benefits of having ScriptManager such as<\/p>\n<h3>Debug\/Release Support<\/h3>\n<p>If you are debugging your application(debug=true) in web.config then ScriptManager will serve the scripts from debug path(non minified scripts) such as &ldquo;~\/Scripts\/jquery-1.7.1.js&rdquo;<\/p>\n<h3>CDN Support<\/h3>\n<p>If your set EnableCDN=true on the ScriptManager control, then all the Scripts will be served from the CDN path such as &ldquo;<a href=\"http:\/\/ajax.aspnetcdn.com\/ajax\/jquery-1.7.1.js\">http:\/\/ajax.aspnetcdn.com\/ajax\/jquery-1.7.1.js<\/a>&rdquo;<\/p>\n<h3>Override Script Mappings<\/h3>\n<p>Let&rsquo;s assume that you wanted to override the scriptmappings to change the CDN path where these scripts are served from. You can do so by changing the scriptmapping before the page is accessed. Typically doing this in Global.asax is better<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\"><span style=\"color: #0000ff\">string<\/span> str = <span style=\"color: #006080\">\"1.7.1\"<\/span>;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    ScriptManager.ScriptResourceMapping.AddDefinition(<span style=\"color: #006080\">\"jquery\"<\/span>, <span style=\"color: #0000ff\">new<\/span> ScriptResourceDefinition<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        Path = <span style=\"color: #006080\">\"~\/Scripts\/jquery-\"<\/span> + str + <span style=\"color: #006080\">\".min.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        DebugPath = <span style=\"color: #006080\">\"~\/Scripts\/jquery-\"<\/span> + str + <span style=\"color: #006080\">\".js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnPath = <span style=\"color: #006080\">\"http:\/\/code.jquery.com\/jquery-\"<\/span>+ str + <span style=\"color: #006080\">\".min.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        CdnDebugPath = <span style=\"color: #006080\">\"http:\/\/code.jquery.com\/jquery-\"<\/span>+ str + <span style=\"color: #006080\">\".js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnSupportsSecureConnection = <span style=\"color: #0000ff\">true<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    });<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>Updating Jquery\/JqueryUI libraries<\/h3>\n<p>Let&rsquo;s say a new version of Jquery or JqueryUI comes along. Traditionally you would have to download the jquery packages for these libraries and then update the script references everywhere on your pages. With the above integration of AspNet.ScriptManager.Jquery packges this scenario really becomes easy since when you update Jquery\/JqueryUI you will get corresponding versions of AspNet.ScriptManager.Jquery\/AspNet.ScriptManager.Jquery.UI which will update the scriptmappings to the current version of jquery that was downloaded and you do not have to change anything in your application<\/p>\n<h2>LoadSuccessExpression<\/h2>\n<p>This is a new property which is added to the ScriptMapping and it takes care of the following use case. Imagine that you are serving your scripts from a CDN path and if there is an outage in the CDN, your site will be affected because you will not be able to serve any scripts. This property takes in an expression which evaluates whether the script was loaded correctly and if it fails then it renders the script from the local application path.<\/p>\n<p>Following is how the script tag looks like for jquery(assuming that you are serving scripts from CDN)<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">&lt;script src=<span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/jQuery\/jquery-1.8.1.js\"<\/span> type=<span style=\"color: #006080\">\"text\/javascript\"<\/span>&gt;&lt;\/script&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">&lt;script type=<span style=\"color: #006080\">\"text\/javascript\"<\/span>&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\"><span style=\"color: #008000\">\/\/&lt;![CDATA[<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">(window.jQuery)||document.write(<span style=\"color: #006080\">'&lt;script type=\"text\/javascript\" src=\"Scripts\/jquery-1.8.1.js\"&gt;&lt;\/script&gt;'<\/span>);<span style=\"color: #008000\">\/\/]]&gt;<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">&lt;\/script&gt;<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h2>Remapping Framework scripts<\/h2>\n<p>One neat improvement that happened in ASP.NET 4.5 is the decoupling of the &ldquo;Microsoft Ajax script files(MicrosoftAjaxCore etc)&rdquo; and the WebForms scripts(GridView.js etc). We did the work in this release so you can serve these scripts from your application Scripts folder rather than load then up from System.Web This makes the scripts easily redistributable and updateable. The following section explains on how you can use these scripts and combine them with WebOptimization feature<\/p>\n<h3>Serving Framework Scripts from inside the application<\/h3>\n<p>We created the following 2 packages &ldquo;<a href=\"http:\/\/blogs.msdn.com\/controlpanel\/blogs\/posteditor.aspx\/nuget.org\/packages\/Microsoft.AspNet.ScriptManager.MSAjax\" target=\"_blank\" rel=\"noopener\">Microsoft.AspNet.ScriptManager.MSAjax<\/a>&rdquo; &ldquo;<a href=\"http:\/\/blogs.msdn.com\/controlpanel\/blogs\/posteditor.aspx\/nuget.org\/packages\/Microsoft.AspNet.ScriptManager.WebForms\" target=\"_blank\" rel=\"noopener\">Microsoft.AspNet.ScriptManager.WebForms<\/a>&rdquo; which do the following<\/p>\n<p>Install the Scripts into your application so it looks like follows<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/09\/4405.fxscripts_thumb_2525B8E2.png\"><img decoding=\"async\" width=\"318\" height=\"414\" title=\"fxscripts\" alt=\"fxscripts\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/09\/4405.fxscripts_thumb_2525B8E2.png\" border=\"0\" \/><\/a><\/p>\n<p>These packages also create the following scriptmappings so that they can be registered with ScriptManager as follows<\/p>\n<h3>MicrosoftAjax scripts<\/h3>\n<p>We are registering all the scripts and we are bundling them together as &ldquo;MsAjaxBundle&rdquo;<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">ScriptManager.ScriptResourceMapping.AddDefinition(<span style=\"color: #006080\">\"MsAjaxBundle\"<\/span>, <span style=\"color: #0000ff\">new<\/span> ScriptResourceDefinition<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        Path = <span style=\"color: #006080\">\"~\/bundles\/MsAjaxJs\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnPath = <span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/4.5\/6\/MsAjaxBundle.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        LoadSuccessExpression = <span style=\"color: #006080\">\"window.Sys\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnSupportsSecureConnection = <span style=\"color: #0000ff\">true<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    });<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjax.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys._Application &amp;&amp; Sys.Observer\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxCore.js\"<\/span>, <span style=\"color: #006080\">\"window.Type &amp;&amp; Sys.Observer\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxGlobalization.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.CultureInfo\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxSerialization.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.Serialization\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxComponentModel.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.CommandEventArgs\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxNetwork.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.Net &amp;&amp; Sys.Net.WebRequestExecutor\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxHistory.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.HistoryEventArgs\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxWebServices.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.Net &amp;&amp; Sys.Net.WebServiceProxy\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxTimer.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.UI &amp;&amp; Sys.UI._Timer\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxWebForms.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.WebForms\"<\/span>);<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    PreApplicationStartCode.AddMsAjaxMapping(<span style=\"color: #006080\">\"MicrosoftAjaxApplicationServices.js\"<\/span>, <span style=\"color: #006080\">\"window.Sys &amp;&amp; Sys.Services\"<\/span>);<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>Here is the Bundle definition for these scripts<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">bundles.Add(<span style=\"color: #0000ff\">new<\/span> ScriptBundle(<span style=\"color: #006080\">\"~\/bundles\/MsAjaxJs\"<\/span>).Include(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">                <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/MsAjax\/MicrosoftAjax.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">                <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/MsAjax\/MicrosoftAjaxApplicationServices.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">                <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/MsAjax\/MicrosoftAjaxTimer.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">                <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/MsAjax\/MicrosoftAjaxWebForms.js\"<\/span>));<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Here is the ScriptManger registration for these scripts<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">&lt;asp:ScriptManager runat=<span style=\"color: #006080\">\"server\"<\/span> &gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        &lt;Scripts&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;%--Framework Scripts--%&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"MsAjaxBundle\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;%--Site Scripts--%&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        &lt;\/Scripts&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    &lt;\/asp:ScriptManager&gt;<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>WebForms scripts<\/h3>\n<p>We are registering all the scripts and we are bundling them together as &ldquo;WebFormsBundle&rdquo;<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">ScriptManager.ScriptResourceMapping.AddDefinition(<span style=\"color: #006080\">\"WebFormsBundle\"<\/span>, <span style=\"color: #0000ff\">new<\/span> ScriptResourceDefinition<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    {<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        Path = <span style=\"color: #006080\">\"~\/bundles\/WebFormsJs\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnPath = <span style=\"color: #006080\">\"http:\/\/ajax.aspnetcdn.com\/ajax\/4.5\/6\/WebFormsBundle.js\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        LoadSuccessExpression = <span style=\"color: #006080\">\"window.WebForm_PostBackOptions\"<\/span>, <\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        CdnSupportsSecureConnection = <span style=\"color: #0000ff\">true<\/span><\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    });<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>Bundle Definition<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">bundles.Add(<span style=\"color: #0000ff\">new<\/span> ScriptBundle(<span style=\"color: #006080\">\"~\/bundles\/WebFormsJs\"<\/span>).Include(<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/WebForms.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/WebUIValidation.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/MenuStandards.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/Focus.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/GridView.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/DetailsView.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/TreeView.js\"<\/span>,<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">                  <span style=\"color: #006080\">\"~\/Scripts\/WebForms\/WebParts.js\"<\/span>));<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>ScriptManager registration<\/h3>\n<p>The reason we have the Assembly and the Path attribute here is because ScriptManager special cases these scripts when it tries to load them, so we had to make some special arrangements with ScriptManager code to make this work <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-smile\" alt=\"Smile\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2012\/09\/4428.wlEmoticon-smile_56B12677.png\" \/> This is a process which is called deduping. Basically when the ScriptManager tried to load up these scripts, it can load them up from System.Web or the path attribute and eventually in this case, the ScriptManager dedupes the script references and serves the scripts from the path attribute. This is part of the &ldquo;special arrangement&rdquo; that we did in ScriptManager. We were very cautious when doing this given this code path was on a very critical path for mainline ScriptManager scenarios which we did not want to regress.<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">&lt;asp:ScriptManager runat=<span style=\"color: #006080\">\"server\"<\/span> &gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">        &lt;Scripts&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;%--Framework Scripts--%&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"WebForms.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/WebForms.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"WebUIValidation.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/WebUIValidation.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"MenuStandards.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/MenuStandards.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"GridView.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/GridView.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"DetailsView.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/DetailsView.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"TreeView.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/TreeView.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"WebParts.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/WebParts.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"Focus.js\"<\/span> Assembly=<span style=\"color: #006080\">\"System.Web\"<\/span> Path=<span style=\"color: #006080\">\"~\/Scripts\/WebForms\/Focus.js\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">            &lt;asp:ScriptReference Name=<span style=\"color: #006080\">\"WebFormsBundle\"<\/span> \/&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">            &lt;%--Site Scripts--%&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">&nbsp;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">        &lt;\/Scripts&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">    &lt;\/asp:ScriptManager&gt;<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>When you run this page you will get script references as follows<\/p>\n<div id=\"codeSnippetWrapper\" style=\"margin: 20px 0px 10px;padding: 4px;border: 1px solid silver;width: 97.5%;text-align: left;line-height: 12pt;overflow: auto;font-family: 'Courier New', courier, monospace;font-size: 8pt;cursor: text;direction: ltr;max-height: 200px;background-color: #f4f4f4\">\n<div id=\"codeSnippet\" style=\"padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">&lt;script src=<span style=\"color: #006080\">\"\/bundles\/MsAjaxJs?v=J4joXQqg80Lks57qbGfUAfRLic3bXKGafmR6wE4CFtc1\"<\/span> type=<span style=\"color: #006080\">\"text\/javascript\"<\/span>&gt;&lt;\/script&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: #f4f4f4\">&lt;script src=<span style=\"color: #006080\">\"\/bundles\/WebFormsJs?v=q9E9g87bUDaS624mcBuZsBaM8xn2E5zd-f4FCdIk2cA1\"<\/span> type=<span style=\"color: #006080\">\"text\/javascript\"<\/span>&gt;&lt;\/script&gt;<\/pre>\n<p><!--CRLF--><\/p>\n<pre style=\"margin: 0em;padding: 0px;width: 100%;text-align: left;color: black;line-height: 12pt;overflow: visible;font-family: 'Courier New', courier, monospace;font-size: 8pt;direction: ltr;background-color: white\">    &lt;script type=<span style=\"color: #006080\">\"text\/javascript\"<\/span>&gt;<\/pre>\n<p><!--CRLF--><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>So these were the improvements that happened in the ScriptManager control for registering scripts. In case you want to refresh your memory, <a href=\"http:\/\/weblogs.asp.net\/infinitiesloop\/archive\/2009\/11\/23\/asp-net-4-0-scriptmanager-improvements.aspx\" target=\"_blank\" rel=\"noopener\">ScriptManager<\/a> was greatly enhanced in ASP.NET v4.0 and Dave Reed had a fantastic post about it, which I strongly recommend to go through.<\/p>\n<p>This is cross posted on <a title=\"http:\/\/blogs.msdn.com\/b\/pranav_rastogi\/archive\/2012\/09\/21\/asp-net-4-5-scriptmanager-improvements-in-webforms.aspx\" href=\"http:\/\/blogs.msdn.com\/b\/pranav_rastogi\/archive\/2012\/09\/21\/asp-net-4-5-scriptmanager-improvements-in-webforms.aspx\">http:\/\/blogs.msdn.com\/b\/pranav_rastogi\/archive\/2012\/09\/21\/asp-net-4-5-scriptmanager-improvements-in-webforms.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ScriptManger control has undergone some key targeted changes in ASP.NET 4.5 which makes it easier to register, manage and combine scripts using the ASP.NET weboptimization feature. This post will highlight the changes that have happened to this control Easy Integration with JQuery and JQueryUI The default templates for WebForms ship with the following packages [&hellip;]<\/p>\n","protected":false},"author":408,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[31,7413],"class_list":["post-2164","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-asp-net","tag-scriptmanager"],"acf":[],"blog_post_summary":"<p>The ScriptManger control has undergone some key targeted changes in ASP.NET 4.5 which makes it easier to register, manage and combine scripts using the ASP.NET weboptimization feature. This post will highlight the changes that have happened to this control Easy Integration with JQuery and JQueryUI The default templates for WebForms ship with the following packages [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/408"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=2164"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2164\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=2164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=2164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=2164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}