EXM error: the ID “mainform” is already used by another control

After uploading a HTML email document, you might experience a message saying “The selected page could not be displayed“. Here is a possible cause.

For some HTML templates, where a preview image should be displayed, the message following message was shown instead.

Error message displayed after importing an HTML template

By looking into the Sitecore logs, we have noticed the following error:

Exception: System.Web.HttpParseException
Message: The ID 'mainform' is already used by another control.

When you create a new e-mail campaign by uploading a HTML file, Sitecore Email Experience Manager (EXM) saves this file to the folder sitecore modules/Web/EXM/layouts/Imported.

It also adds some transformations to the internal HTML and save it with the aspx.

I have noticed that in the transformed aspx file, there were two HTML tags with the “mainform” id.

Duplicated attribute id “mainform”

In the original HTML file, it was like this:

Two body tags causes conflict in the EXM

It seems that Sitecore EXM doesn’t differ a commented tag from an non-commented one. The solution was to delete the commented <body> tag and create a new marketing campaign message.

After that, everything worked normally.

Note: As per the Sitecore XP 9.3 Initial release, this issue is not fixed yet. In order to avoid problems with marketing campaigns based on HTML templates, remove any duplicated <body> tags (even the commented ones).

If the above doesn’t apply for you, it might be worth to check Amit Kumar‘s blog post Sitecore Error Troubleshooting: Troubleshooting Sitecore Email Experience(EXM) Email Campaign Message Preview and Test email not being send and this Stack Exchange thread EXM Message Preview fails with “The page cannot be displayed because an internal server error has occurred.”.

Update – Jan 14, 2020

Sitecore Support confirmed it a bug and registered it as a bug in the bug tracking system. The reference number is 385768. More information about public reference numbers can be found here: https://kb.sitecore.net/articles/853187.


Photo by Markus Spiske on Unsplash

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s