Partial Class is a new feature in ASP.NET 2.0, which allow developer to write cleaner source code,
If you ever wrote web application with ASP.NET 1.x code behind option, you should be familiar with those auto generated code in code behind file. If you modify the .aspx file manually with HTML editor, you have to modify the code behind file to match the change you made in aspx file. Other wise the compiler will complain about it.
In ASP.NET 2.0, because of the partial class, this is not a problem anymore, there is no too-generated code written into code behind file during development phase. the code behind file contain one partial class now. this partial class does not contain any definition of the server control on the aspx page, This partial class not only make the source cleaner easy to read, but also eliminate the sync issue when developer modify the aspx file.
But the compile has to have the other part of the partial class to compile the application and .NET framework has to have the assembly to run the the web application. ASP.NET generate the necessary class and compile classes into assemblies for you. during compilation, first a class file is generate represent the page structure of the aspx file, then partial classes compiled into assemblies and saved in the temporary asp.net files folder. Each web application has it own temporary folder.
A typical path should look like
C:\WINDOWS\Microsoft.NET\Framework\[version number]\Temporary ASP.NET Files\testwebsite\a712b9f4\8b84eea0
You can get the temporary path from HttpRuntime.CodegenDir.
In this directory for each page (aspx file) you will find a file with the name [pagename].aspx.****.compiled. **** is a hash value based on the directory. You will also found 3 .cs or .vb files (depend on which language you use) associated with each page.
We will go into these files next time.