Simon Larsen Simon Larsen - 1 year ago 69
ASP.NET (C#) Question

old jquery version is automatically included in webforms

I have a c# webforms project. In the output html in the div "aspNetHidden" is a link to

<script src="/Scripts/jquery-1.8.2.js" type="text/javascript"></script>

I cannot figure out how to remove this code. It's not in the master page file, and I can't seem to find it anywhere. I would like to use a newer version of jquery, and place the reference at the bottom of the page instead.

I suspect it's from one of the installed NuGet packages, but I can't figure out which one, and I think i need them all.

If i create a new project and select ASP.NET Web Forms Application, the jquery link is there. I'm using visual studio express 2012.

EDIT 2: Found a solution - posted as an answer for others with similar problem to see.

Answer Source

I found a solution. It's added by the scriptmanager, but can be overridden by adding the following in the global.asax. I don't know if I can disable it completely, but this works for me.

string str = "1.10.2";
        ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition
            Path = "~/js/jquery-" + str + ".min.js",
            DebugPath = "~/js/jquery-" + str + ".min.js",
            CdnPath = "" + str + ".min.js",
            CdnDebugPath = "" + str + ".min.js",
            CdnSupportsSecureConnection = true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download