Thursday, July 3, 2008

VS 2003 to VS 2005 asp.net not working with ajax 1.0.

A migrated asp.net application from 1.1 to 2.0 with ajax 1.0 is found that the ajax part is not working. I did some research and found that the culprit is
tag in the web.config

Background:
ASP.NET 1.0 and 1.1 didn't emit XHTML compliant markup from many of its server controls. ASP.NET 2.0 changed this and by default emits XHTML compliant markup from all controls.
One of the things we noticed in the early ASP.NET 2.0 betas, though, was that when upgrading customer applications a lot of the applications had assumptions that the page output was not XHTML compliant. By changing our default output of the server controls to be XHTML, it sometimes modified the visual rendering of a page. For backwards compatibility purposes the switch above that allows developers to render controls in "Legacy" mode (non-XHTML markup the same as ASP.NET 1.1) as well as Transitional mode (XHTML Transitional) as well as Strict mode (XHTML Strict).
By default when you use the VS 2003->VS 2005 Web Project Migration wizard (for both web sites and web application projects), your web.config file will have the legacy switch added.
Solution:
Unless you know of known issues that your site has when running in XHTML mode (and which you don't have time yet to fix), It is recommend removing the section from your web.config file (or you can explicitly set it to "Transitional" or "Strict").
This will make your HTML output standards compliant. Among other things, this will cause the HTML from your server controls to be "well formed" - meaning open and close tag elements always match. This is particularly important when you are using AJAX techniques to dynamically replace the contents of certain HTML elements on your page (otherwise the client-side JavaScript sometimes gets confused about container elements and can lead to errors). It will also ensure that ASP.NET AJAX works fine with your site.

Source

No comments: