Wednesday, April 16, 2014

The server tag is not well formed. ASP.NET IIS Express aspx ascx

When working with ASP.NET with IIS Express, I hand coded the user control .ascx file using the code behind approach.
For the <%@ Control > tag, the CodeBehind is for the .dll file - not the .cs source file. To use the source file, you will have to use the CodeFile attribute. To use the CodeBehind attribute, you also have to put the .dll file in the \bin sub-directory - using ~\file.dll in the CodeBehind will not work as other directives tags (i.e. ASP.NET @ tags).

There is a problem with IIS Express when parsing the XML comment (i.e. ). Somehow, the IIS Express will try to look for 'runat' inside the comment area and try to interpret it as server tag. This prevents commenting out server tags when needed. By altering the text: runat (e.g. runat_), you can avoid the problem caused by this bug. This problem applies to .aspx and .ascx files.


No comments:

Post a Comment