Post navigation

New Features in ASP.NET 4.0

ASP.NET 4.0 is neither a revolutionary change nor a refactoring of the existing ASP.NET. Instead, it consists of a number of small-scale changes that allow developers to have a strong control of certain frequently used events. What makes ASP.NET 4.0 more effective than the already existing versions of ASP.NET are its rich features and powerful enhancements.

ViewState Control Enhancements

One of the major drawbacks of ASP.NET Webforms is ViewState, which can add significantly to the page size and slow performance. While initially you could set the EnableViewState property to true or false, all the controls, by default inherit and so if you set it at the control level, the behavior was inconsistent. However, with ASP.NET 4.0, the new ViewStateMode property helps to determines every control whether the ViewState should be enabled, disabled, or inherited.

Data Control Enhancements

Another interesting new enhancement in ASP.NET 4.0 is that the LayoutTemplate of the ListView data control is now optional – so you can just use the ItemTemplate of the control to display data. Here’s an example:

In ASP.NET 4.0 all the necessary components to use ASP.NET Routing are inbuilt. These include theIRouteHandler implementation (PageRouteHandler class) that serves up the right IHttpHandler to service the request and a couple of expression builders to help capture parameters from routed requests and also generate route URLs. You simply need to set up your route patterns in Application_Start() as you do for ASP.NET MVC.

SEO Enhancements

In addition to Webforms Routing, there are a couple of minor additions to ASP.NET 4.0 to make it easier to set the Keywords and Description meta tags on a page. The page class in ASP.NET 4.0 now has two new properties, namely, Keywords and Description. These can be set either in markup code or from the code behind so that you can generate the meta tags dynamically.