Description: You may receive an InvalidCastException error in an ASP.NET-connected Web application.
Cause:You may receive an InvalidCastException error in a Microsoft ASP.NET-connected Web application when the following conditions are true:
• The Web application uses a master page, a user control, or pages that reference each other.
• The master page, the user control, or the pages are batch compiled into a single assembly.
• One of the batched dependencies is changed and causes a recompilation.
• A dynamic call to load a reference is made, such as a call to the LoadControl method.
Solution: Hot fix is available from Microsoft at this url.
http://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=3705