ASP.NET 4 has introduced a number of features to improve the core ASP.NET services which includes output caching and session-state storage and added the routing, object cache, HTML, URL, Http encoding and multi-targeting targetFramework attribute in the compilation element of the Web.Config file.
Here is the list and some explanation of new features.
In .Net Framework 4.0 there are added features which can take large size and placement in Web.config which could mess up the Web.config code, so the major part of configuration elements are stored now in machine.config which able to be empty or just few lines which maximize the readability.
Extensible Output Caching
In the previous versions output of pages, controls and http responses are generated in memory, there is a limitation because each generated output is stored in memory which in turns consumes more memory when server experience high traffic. ASP.NET framework extended this feature and now we can add custom cache provider. We can store cache responses in local, remote disk or at cloud storage.
Permanently Redirecting a Page
In earlier versions developers used Response.Redirect() which set the http response status to 301 (temporarily redirect), which causes extra round trip to find the old URL. ASP.NET 4 adds a new RedirectPermanent helper method which facilitates to issue the HTTP 301 Moved Permanently responses, as in the following example:
Search engines and other user agents easily recognize the permanent redirects and would store the new URL that is associated with the content. Please think about it to use when needed.
Shrinking Session State
ASP.NET provides two default options for storing session state across a Web farm: a session-state provider (out-of-process) and a session-state provider that stores data in a Microsoft SQL Server database. Both options are required serialization when transferred the data to remote storage, and when data size grows it raise the performance issues.
ASP.NET 4 introduces a new option called compression both kinds of out-of-process session-state providers. When the attribute compressionEnabled is set to true then ASP.NET compresses (and decompress) serialized session state by using the GZipStream class.
<sessionState mode = “SqlServer” sqlConnectionString = “data source=server; Initial Catalog=aspnetstate” allowCustomSqlDatabase=”true” compressionEnabled = “true” />
Now we can create an application which can target a specific version of .Net framework. ASP.NET 4 introduced a new attribute targetFramework in configuration element.
Web Forms is the core feature of ASP.NET since the first release. Enhancement in this area has been taken.
• We can set meta tags.
• Now we have more control over view state.
• Routing support in Web Forms.
• Able to set the static ID to control.
<%@ Page Language=”C#” AutoEventWireup=”true” Code=Home.aspx.cs Inherits=”Home” Keywords=”some,keyword,here” Description=”This is my home page” %>
Manage View State for each control separately
By default Page view state is enable which in turn enable the view state of each control contained in that page. We can deal the view state property of each control separately, we can disable the control on a page even the page view state property is enable.
asp:PlaceHolder ID=”MyPlaceHolder” runat=”server” ViewStateMode=”disabled” >
ASP.NET Chart Control
The Chart control is the added feature which provides the data-visualization in the .NET Framework. We can create ASP.NET pages that have compelling charts for complex statistical or financial analysis. Basically Chart control was introduced as an add-on to the .NET Framework version 3.5 SP1 release but now it is the part of the .NET Framework 4 release.
The control includes the following features:
• More than 30 chart types.
• A wide range of appearance settings chart elements.
• Most chart types have 3-D support.
• Easy binding and manipulation of chart data.
• Support for Ajax.