there are two types of webforms projects. website, where the code is compiled on the server with the aspnetcompiler and web application project. in web application projects, the code behind files are compiled into a dll, and only the .aspx is compiled on the host.
the web site model uses the codefile="filename" attribute and the cs file is included in the publish. the web application uses the codebehind="filename" and only the dll is included in the publish. web application may require a designer file which is the bridge between the code behind cs file and .aspx file.
with asp.net 4, the inherits attribute instead of the code behind and the designed file is no longer used, instead the form objected are defined in the code behind.