ASP.NET 4.0 includes enhancements in many areas. This article is an overview of the new and major improvements that are included in ASP.NET 4.0.
Output Caching
Since ASP.NET 1.0, output caching has is being used to store the generated output of pages and controls. On subsequent requests, ASP.NET can serve the HTML content more quickly from memory instead of generating the output from scratch. However, this approach has the limitation that the generated output always has to be stored in memory and if the website experiences heavy traffic the memory requirements can be drastic.
ASP.NET improves output caching by providing output-cache providers. Output-cache providers can use any storage medium to store the generated output. This storage medium can vary from local or remote disks to cache engines.
A new cache provider can be created deriving from OutPutCacheProvider class. We can configure the Cache provider in the Web.config file in the new provider's subsection of the outputCache element.
We can use the different providers for different controls using the providerName attribute of the Output cache element.
- <%@ OutputCache providerName="MyCache" %>
Redirecting page to a new link
The website content is moved during the lifetime of the web application from one URL to another. This was handled by using the Redirect method to redirect to the new URL. One disadvantage with this method is that the Redirect method results in extra roundtrip to the server.
ASP.NET 4 introduces the RedirectPermanent method.
Search engines can store the new URL associated with the content removing the need to use the Redirect method for moved content.
This method can be used to move to the new link:
Response.RedirectPermanent("/NewURL.aspx");
Enabling Viewstate on Control basis.
In the previous versions of ASP.NET, we can't turn off the viewstate for the entire page and then unable it for some of the controls that need it. We can do so in ASP.NET 4.0. This is more convenient than disabling the viewstate on control by basis. You can set the ViewStateMode for the page to false and then enable it for individual controls.
Row Selection in GridView and ListView
In previous versions of ASP.NET in Gridview and Listview rowselection was on the basis of RowIndex. If we selected the nth row on a page and moved to another page then the nth row was selected on the moved page as well.
It is more desirable not to select any row in the moved page and when the user comes back on the original page he should see the nth row selected. ASP.NET 4 provides persisted selection in which row selection is based on the data key. We enable persisted selection by using the PersistedSelection attribute to "true" in the GridView Control.
Session State Compression
There are two options to store session state data out of process one is session state provider that stores data in session state server and the second is session state provider that stores data in a Microsoft SQL Server database. The size of the serialized data stored in the session state server and SQL Server can be too large. In ASP.NET 4 there is a compression option to store the serialized data. This option can be enabled using compressionEnabled attribute in the Session State element.

Gary BalesPosted May 27, 2010, 9:41 AM
Is the markup in need of correction at the bottom of the article.