I am faced with an error many times, and I need some guide to solve it forever:
Compilation Error
Description: An error occurred during the compilation of a
resource required to service this request. Please review the following
specific error details and modify your source code appropriately.Compiler Error Message: CS0433: The type \‘ASP.controls_sites_linkbox_ascx’ exists in both
‘d:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\marja\8d9a6443\9cb45dad\App_Web_1hpsmwqz.dll’ and
‘d:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\marja\8d9a6443\9cb45dad\App_Web_4lhnbswq.dll’
The problem will be solved when I close Visual Studio. But it is not normal. Isn’t it dangerous when we publish an application on the server? Might it appear again and again?
If you don’t want to run into this problem, avoid "Web Site" projects if you can – and favour "Web applications".
Really, a "Web Site" project is just a regular web application, with one key difference. Instead of having a named .dll for your application (e.g., Something.Web.dll), the name of your assembly is autogenerated (in your case, App_Web_1hpsmwqz.dll).
Now, your problem stems from the fact that this has happened a couple of times, and you’ve got an older autogenerated file kicking around—which is still in your application’s DLL file search path. So the compiler ends up finding two classes with the exact same namespace. It doesn’t know which to pick.
You can do as Ankur suggests, and delete the temporary files. Long-term, I’d consider turning this into a proper web application.
I did one, and precisely one "Web Site". I hit this problem a couple of times and resolved that I’d never do one again. I moved back to web applications and (obviously) never had the problem again.