More ASP.NET 2.0
I have continued to experiment with ASP.NET 2.0 using MS Visual Studio 2005 Beta1. One cool thing that I have noticed is that now you can easily have pages built with different languages in the same project; one aspx (with code page) in VB and another in C#.When you create a new Web site in VS 2005 you are asked for the ProjectType (VB, C# or J#). Pick one, let’s say VB, and then create the site. You get a page named Default.aspx (notice the page name change from Visual Studio 2003) and a code file named Default.aspx.vb. Now add a new page (Web Site Add New Item). In the Add New Item Dialog box, there is a drop down where at the bottom you choose the language for the page being added. Choose C# and you get a page named Default2.aspx and a code page named Default2.aspx.cs. This results in the project having pages (with associated code pages) written in different languages, one in C# and one in VB.
This is possible because of partial classes and the compilation model for them in ASP.NET 2.0. On the first visit to a page, that page (aspx) in-line code (partial class) and the associated (aspx.vb or aspx.cs) code file (partial class) are compiled using the selected language as specified on the Page declarative (@ Page Language="VB...).
Here is one difference between ASP.NET 2.0 and ASP.NET 1.x; in ASP.NET 2.0 the page declarative Language= attribute affects both the associated code file and the aspx page – they are partial classes that together comprise the class for the page; if language=VB then both the code page and aspx page (in-line code) have to be VB. One part of a partial class is not compiled with one language and the other part of a partial class compiled with a different language.
For ASP.NET 1.x the Language= attribute affects only in-line code for the aspx page, not the associated code page. So, in ASP.NET 1.x using VS 2003 you could have an C# project (All code pages compiled with C# into the .dll in /Bin when you do a build), but in any particular aspx page you could change the Page Language= attribute to VB and have VB.NET in-line code for that page.
So, your aspx page in-line code would be in VB.NET and the associated code page would be C#. When you build the project using VS 2003 all code pages are compiled to a single dll using the language specified for the project. The ASP.NET 1.x compilation model compiles aspx pages as they are visited, "Hooking" them up with the associated precompiled .dll. The aspx pages themselves are compiled on the first visit using the language specified in the Page Language= attribute on the Page declarative.
So the short of it is, for ASP.NET 1.x the Language= attribute of the Page declarative controls the language for in-line code compilation of the aspx page only, while for ASP.NET 2.0 Language= attribute controls the language used for compilation of both the aspx page and the associated code file. Also, for ASP.NET 2.0 it is easy to have pages with different languages (in-line and code ) residing in the same Web site.