Tuesday, October 21, 2008

The pain of converting an ASP web site to a web application

       Microsoft confused a lot of people when they changed the solution type for web sites in VS2005. After this they realized that this was nowhere near perfection so they reintroduced the web application model (the one which have the solution file) in VS2005 SP1 and VS2008.
      The problem this caused is that in certain situations we must convert some legacy sites from the web site model to the web application one. There already exists a pretty good tutorial for this, but it's minimizing some pretty important steps.
      If you need to convert a web site to the web application model you must be really careful with the step in which you add the required namespaces. First of all, this will take a while depending on the size of the site, secondly it creates some issues not easily found at first:
  • If you have Register directives like this one:
<%@ Register Namespace="FancyControls" TagPrefix="cc1" %>
you will need to add  the assembly property:
<%@ Register Namespace="FancyControls" TagPrefix="cc1" Assembly="SiteControls" %>
otherwise your controls won't be recognized and you will get "Element not known error" message.
  • You must update the javascript code which is calling Ajax methods in order to add the required namespaces.
This process is pretty painful, I will update this post if other issues pop-up.

Good luck at converting.