Mike Ormond (Microsoft UK) presented a “What’s new in ASP.Net 4.0” at this month’s Southampton NxtGenUg meeting. While there appears to be no major technology change, there are a host of changes to enhance performance; and augment the current user and developer experience (ASP.Net 3.5). The discussion focused primarily on the new features in the Presentation Layer. It was a pretty lively as Mike competed head to head with a brass band practicing in the adjoining room of the Venue. Mike deliver key points in sync with many crescendos of the Harry Potter and other theme tunes . Good effort!
The next Southampton NxtGenUp meeting is scheduled for August 20th. Redgate Software Test Engineer Ben Hall will be talking about testing ASP.Net applications.
For for those who have not yet had a chance to play with the Beta 2 versions of Visual Studio 2010 and not able to attend the session, I have listed some of the content below.
Routing handler - WebForRoutHandler
The same routing mechanism as used in MVC is provided for ASP.Net web pages. This is used to intercept requests to extract data or to direct requests as per the routing table information. In a similar fashion to ASP.Net MVC, the routing information is added to the application’s RouteTable in the Global.asax file. Check out Scott Galloway’s blog for more.

Page.Keywords and Page.Description properties
Assigning values to the Meta tag new Keyword and Description properties results in the values of these properties being rendered to the page as Keyword and Description.

ClientIDMode property
If this property is set to Static, then the IDs of the related control will not be altered by ASP.Net in the rendered page. This is good news when using jQuery as you no longer have to do the magic to locate controls at runtime.
If the ClientIDMode property is set to Predictable, the same is achieved in Repeater and GridView controls where, for instance, a check box is rendered for each row of data. The checkboxes will be rendered with sequential numbers, ( CheckBox_05, CheckBox_06 …). The rendered name can be even further fine-tuned by specifying a ClientIDRowSuffix to be applied to each control specified in the ItemTemplate element nested in the TemplateField element. The rendered control IDs of the labels with the ID=”user” in the below code will be UserSuffix_UserID_1, UserSuffix_UserID_2 etc.
ASP.NET currently generates pretty long names for the controls. Several hundred rows of long generated names will inevitably result in page bloat and performance issues. A further benefit of being able to control IDs of rendered controls (such as in repeaters), is that when a page is configured to use View State, its size can be limited to some degree.
ListView EnablePersistedSelection property
Consider the situation in ASP.Net 3.5, where a ListView with Paging is populated with data extending over more than one page. If the user selects a Row – say Row 3 - and then navigates to subsequent pages, Row 3 remains selected in the subsequent pages of the ListView (provided the it contains at least 3 rows of data). In ASP.Net, this behaviour can be disabled by setting the EnablePersistedSelection to false. Mike describes this and some of the below changes (with screen shots) in his blog here.
FormView rendering
In the current version of ASP.Net FormView always renders as a table. A RenderTable property of the FormView Control has been provided in ASPNet 4.0. If this is set to false the control will not be rendered as a table.
QueryExtender Control
This control works with LinqDataSources or EntityDataSources. Properties that can be applied to order and filter data. Doing so will essentially extend the Linq expression tree for the query. Some of the attributes are:
- OrderByExpression – obviously orders the queried data.
- RangeExpression – obviously specifies the range of data to be returned.
- Parameters – parameters passed into the query
Control level View State rendering
ASP.Net 3.5 allows one to disable View State at the page level. In Asp.Net 4.0, the View State can be set to render at a control level. Controls inherit View State rendering from their container. Therefore, if the View State is disabled at the page level, a developer can enable View State if required at a control level.
Compressed Session State
Session state can to be compressed for State Server or SQL Server persistence prior to being sent across the wire. When configured for compression (set in the web.config file), the Session State will be compressed using GZip.
Caching
Caching is being factored out of the Web namespace. This will permit the .Net Framework caching to be used in Winforms / WPF applications without the need for referencing Web assemblies.
Ajax
Mike talked about the Ajax enhancements which are quite compelling. There are probably too many to try and list them in this blog but the new DataView ASP.Net Ajax control allows declarative data binding is worth mentioning. The DataContext handles tracking of data changes therefore permitting batch operations. More on this can be found here on the official ASP.Net Website
The following URI points to a white paper describing the above changes and others made to ASP.Net 4.0 B1 version. http://www.asp.net/learn/whitepapers/aspnet40/