You can only have one <head runat=server> control on a page...

Problem

You get this error when running your application:

Server Error in XXX Application.

You can only have one <head runat=”server”> control on a page.

Description: An unhandled exception occurred during the handling of the current web request.  Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:  System.Web.HttpException: You can only have one <head runat=”server”> control on a page.

Source Error:

Information regarding the origin and location of the exception can be identified using the exception stack trace below.

This error occurs when the ASPX page has one or more missing tags, such as <head>, <body> or <form>.  Most likely, your page is damaged.

If an ASPX page is responsible for the error…

Step 1:  Inspect the ASPX page in an external editor and repair the damage so that it conforms to the HTML syntax and, where appropriate, ASPX syntax.

Step 2:  Ensure that the page has appropriate <doctype>, <html>, <head>, <body> and <form> tags.

Step 3:  Rebuild the page (Build, Rebuild All)

If an ASCX control is responsible for the error…

Step 1:  Inspect the ASCS control in an external editor ensure that the ASCX control does NOT have <doctype>, <html>, <head> and <body> tags.  The presence of these tags will conflict with the page in which the ASCX control is embedded, causing this error to occur.  For guidance, compare your ASCX control file with those created directly by Iron Speed Designer, such as the Sign In control (SignIn_Control.ascx).

Step 2:  Rebuild the page (Build, Rebuild All)

See Also

Part VII:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages