Problem:
After an upgrade of a Sitefinity project from an older version to 4.1, you get an error for duplicate control IDs when you visit a page from your site. The exact error text is similar to this:
Compiler Error Message: CS0102: The type 'ASP.sfpageservice_d12edd17_5884_46ab_a1bf_6d1f87e7b8aa_inforetail_aspx' already contains a definition for 'C000'
OR
Parser Error: The ID 'C001' is already used by another control.
Solution:
The error is caused by several controls on the same page having the same ID. If your site is not large, we would recommend going manually through all pages and changing the ID attribute of all controls manually. To do this, open the problematic page in edit mode. Then for each control on this page, click Edit to open the control settings. Switch to advanced mode, if necessary:

Then for the ID property, write a value unique among all controls on this page:

Do this for all controls on the page. This approach is the safest one, but not always practical. If your site is larger, you can execute code to go through all pages and change the IDs automatically. The code that has to be executed is attached to this KB article. Please remember to back up your database before executing it.
Note: If you have created some custom controls for your site and rely on specific IDs when they are put on the page, your code may break after this change.
Installation instructions:
Download the zip archive attached and extract the files to your project's root folder. Include the ASPX page in your project, build the project and access the aspx through the browser.