At my day job, we started getting a strange compilation error when accessing one of the pages (the ASPX file).
Upon first access to an ASPX file, ASP.NET parses the ASPX file and combines it with the ASPX.cs/ASPX.vb (code behind) to create one single .cs/.vb file, compile it and loads it into the memroy.
The error was quite strange:
The type or namespace name ‘Compatibility’ does not exists in the namespace ‘System.Web.UI’ (are you missing an assembly reference?)
This was just a simple page. Not fancy AJAX code. You can see how it looked when I set customErrors=”true” in the web.config here.
After digging a bit more, I’ve turned on the debug=”true” in the <compilation> tag in the web.config file and got a more details error (look at the screenshot here).
I was not familiar with any System.Web.UI.Compatibility namespace in ASP.NET so I searched throughout the project. I came across this namespace in the web.config file itself in the <system.web> \ <pages> \ <tagMapping>.
This set of configuration tags is added for use with AJAX.NET and it simply says that if you see System.Web.UI.WebControls.CompareValidator replace it with System.Web.UI.Compatibility.CompareValidator that is found at System.Web.Extensions - System.Web.Extensions is one of the AJAX.NET assemblies.
A light bulb flickered above my head and I figured that the problem was in the ASPX compilation.
When you set debug=true in the <compilation> tag in the web.config, the path at the bottom of the error page will actually include the temp .cs/.vb file ASP.NET has created as well as a few .cmd file which are in fact the command line passed to the C#/VB.NET compiler to compile the code.
I checked it out and it seems System.Web.Extensions was missing from the command line.
I’ve added it to the <compilation> \ <assemblies> and it worked.
I still don’t know what is the exact cause of this problem, but I figured having an extra reference in the compilation shouldn’t cause any harm. At least for now.








Entries (RSS)
February 1st, 2007 at 5:43 pm
Could you describe in more detail how you added the assembly reference?
February 1st, 2007 at 6:03 pm
I’ve opened the web.config file in my application, searched the <compilation> section. Under it there should be an <assemblies> section in which I added the reference to the assembly, like this:
<compilation>
<assemblies>
<add assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
</assemblies>
</compilation>
That’s all.
September 5th, 2007 at 9:42 pm
This may not pertain to this particular issue but it did in my case, if you used a Beta version of Ajax.net remove the Tagmappings in web.config to the Validators as they have been moved from TabMappings to System.Web.Extensions.
This happened to me because I started working on a project that had been moth-balled and used a beta version of Ajax.net.