Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to add ScriptManager in Global.asax?
Message
 
 
To
08/05/2014 12:14:19
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01599584
Message ID:
01599741
Views:
33
>>>>The Global.asax be default has several methods (e.g. Application_Start, Session_Start, and so on). I need to add the ScriptManager call (as shown below) to the Global.asax
>>>>
>>>>
>>>>ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition {
>>>>
>>>>                Path = "~/scripts/jquery-1.4.1.min.js",
>>>>
>>>>                DebugPath = "~/scripts/jquery-1.4.1.js",
>>>>
>>>>                CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.min.js",
>>>>
>>>>                CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.js"
>>>>
>>>>            });
>>>>
>>>>
>>>>In which method of Global.asax.cs the above code should go? TIA
>>>
>>>Answer: this code goes to Application_Start method.
>>
>>This was a good answer on my PC (running the application from VS 2012). But when I deploy this project on customer site I get the same dreaded message:
>>
>>WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a  ScriptResourceMapping named 
>>jquery(case-sensitive). 
>>
>>So apparently my Global.asax.cs is not the right place. Where else do I specify "ScriptManager.ScriptResourceMapping"?
>
>Can you add some logging to verify that the Application_Start method is being hit. On some websites I upgraded from .NET 2 to .NET 4 I've had to delete the precompiledweb.config file and the previous bin folder for the new global.asax file to be recognized. There are also several other suggestions at http://stackoverflow.com/questions/1632636/global-asax-not-loading-for-precompiled-asp-net-website such as changing Application_Start to Application_OnStart.

I was thinking exactly the same (earlier) that I need to add some way to know that the Application_Start method fires. I will add a code to create a token file somewhere. And in my case this is also upgrade from .NET 2 to .NET 4 so maybe I am having similar problem. I will check suggestions in the stackoverflow post you referenced.
Thank you very much!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform