Showing posts with label AJAX. Show all posts
Showing posts with label AJAX. Show all posts

Wednesday, August 1, 2007

AJAX Error: Error: Sys is undefined

AJAX Enabling an Existing ASP.NET Website!!

A common mistake new AJAX developers make is to just start adding AJAX controls to their existing ASP.NET 2.0 web project. However after adding say the time it will let you know that you need a scriptmanager control. That's easy, drag-drop , press F5 or right click, view in browser. Waaaahhh no AJAX, just a Javascript error in the bottom right of IE7, which when expanded states:
AJAX Error: Error: Sys is undefined
Well if we had started out with an AJAX-enabled Website and looked closely at the Web.config we would have noted one very important difference between the two:

<httpmodules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpmodules>


For more info:
How Do I: Add ASP.NET AJAX Features to an Existing Web Application?

Wednesday, April 18, 2007

Could not load file or assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its ...

Could not load file or assembly 'Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

I just had a call from a client asking how we can solve this error while he was deploying his Intranet from his local machine to the production server. After a lot of searching he was linked to the MS site and asked to request a hotfix (FIX: You may receive an InvalidCastException error in an ASP.NET-connected Web application)

SYMPTOMS
loadTOCNode(1, 'symptoms');
You may receive an InvalidCastException error in a Microsoft ASP.NET-connected Web application when the following conditions are true:
• The Web application uses a master page, a user control, or pages that reference each other.
• The master page, the user control, or the pages are batch compiled into a single assembly.
• One of the batched dependencies is changed and causes a recompilation.
• A dynamic call to load a reference is made, such as a call to the LoadControl method. In this case, you may receive an error message that resembles the following:
Unable to cast object of type 'ASP.type' to type 'ASP.type'.Note In this error message, type is a placeholder for one of the batch compiled types. You may also receive an error message that resembles the following:
Could not load file or assembly 'App_Web_xxxxxxxx, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Now he had been using master pages and webcontrols etc.. so the fix was tempting.. However as a precaution he called me and I looked deeper....
Enter ..... AJAX


Luckily I remembered he had just added AJAX to the site only a few days ago and so I dug some more. Finally tried out the site on a test server and reproduced the error but then I confirmed that installing the Ajax 2.0 Extensions would fix it..... and it DID!!