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.

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.

In the original HTML file, it was like this:

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.

Credits

Photo by Markus Spiske on Unsplash.

comments powered by Disqus