For some reasons I don’t know all the elements references in my .aspx.cs are undefined. For example:
In MyPage.aspx I have <asp:TextBox runat="server" ID="UserName" /> and in MyPage.aspx.cs I do UserName.Text="abc". Then after building I get an error that sais: The name 'UserName' does not exist in the current context.

Even in my Global.asax I get an error that sais the characters are not recognized:

I really don’t know what it is, maybe something with my namespaces or something like that. But as I see – all the namespaces are correct.
How can I solve those errors?
If you’ve added some of the *.aspx and *.ascx files from another project, check that the build action of the *.aspx.designer.cs and *.aspx.cs files are set to compile.