Fixing the Sys.Res. namespaceContainsObject error with ASP.NET Ajax+Silverlight 17. July 2007 Comment (0) When you try to implement a Silverlight project into an existing ASP.NET Ajaxwebsite you will just click Add Silverlight link to a specific directory in yourwebsite (don't spam everything into your main directory). Then you might wantto use same the html code from your test sites in the ASPX page, like this:<head runat="server"> <title>Some title</title> <script type="text/javascript" src="Silverlight.js"></script> <script type="text/javascript" src="Default.aspx.js"></script></head>And the SilverlightControlHost somewhere in the body (in the form).You also might want to move the body onload method to a div panel in case youare using a master page or you want multiple silverlight controls: <div id="SilverlightControlHost" onload="document.getElementById('SilverlightControl').focus()"> <script type="text/javascript"> createSilverlight(); </script> </div>You might be able to compile and start that without any problems, BUT if youalready have a lot of ASP.NET Ajax code you might end up with this error (anda bunch more, most of them with Sys.Res in the error description).Line: 967Error: Sys.Res.namespaceContainsObject is null or not an objectThe problem is that both Silverlight and some generated ASP.NET Ajax javascriptfiles use the same javascript object (Sys.Res), but overwrite it and disable thefunctionality that is needed. You won't find much information on that withgoogle, but the solution is very simple! Just put the scripts directly intoyour ScriptManager of the site like this and remove the scripts from the header: <asp:ScriptManager ID="ScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Path="Silverlight.js" /> <asp:ScriptReference Path="Default.aspx.js" /> </Scripts> </asp:ScriptManager> Hope this helps and saves you some time.