.Net 4.0 is latest technology and it provide Extra features then previous version. There are added new features in this section of .net as given
- Application Compatibility and Development
- Managed Extensibility Framework
- Windows communication foundation
- Windows workflow foundation etc.
Main Features in .Net
- Routing concept in .Net
- Page.MetaKeyword and Page.Description Properties
- More data services in WCF
- Output Caching Extensibility
- Session State Compression
- Improvements on Microsoft Ajax Library
- Adding new Syntax for Html Encode
- Response.RedirectPermanent method
- Increase URL character length
- Auto start ASP.Net application
- Web Config file refactoring
- Predictable ClientId
Routing concept in .Net
The routing engine can decouple the URL in an incoming HTTP request from the physical Web Form that responds to the request, allowing you to build friendly URLs for your Web applications. In ASP.Net 4.0, adding some more class like MapPageRoute in Route class.
How use the routing check this link
Page.MetaKeyword and Page.Description Properties
ASP.NET 4.0 is the addition of two properties to the Page class, MetaKeywords and MetaDescription. These two properties represent corresponding Meta tags in your page.
ASP.NET 4.0, there are two new properties in the code behind file;
Page.MetaDescription – equivalent to Meta name “description”
Page.MetaKeywords – equivalent to Meta name “keywords”
More data services in WCF
ADO.NET Data Service has been renamed to WCF Data Services, and has the following new features
- Data binding.
- Counting entities in an entity set.
- Server-driven paging.
- Query projections.
- Custom data service providers.
- Streaming of binary resources.
Output Caching Extensibility
To create a custom output-cache provider, a class which derived from System.Web.Caching.OutputCacheProvider has to be created in ASP.NET 4.0. There are four public methods which you have to override in order to provide your own implementation for add, remove, retrieve and update functionality.
Check this blog:
Session State Compression
The ASP.NET session state is a mechanism to maintain session-specific data through subsequent requests.
Compression can be enabled by setting the compressionEnable to true in the web.config file. In this example, the session-state data will be serialized / desterilized using System.IO.Compression.GZipStream.
<sessionState mode="SqlServer" sqlConnectionString="data source=Arora;Initial Catalog=Sample" allowCustomSqlDatabase="true" compressionEnabled="true"/>
Improvements on Microsoft Ajax Library
There are some significant improvements in the Ajax Library in the ASP.NET 4.0 as
- Scrip Loader – the new script loader control enable developers to load all the required scripts only once.
- Client Datasource- it Support all consuming data (dataview in WCF apllication) work asynchronously in Ajax.
Adding new Syntax for Html Encode
Html Encode method encodes a particular string to be displayed in a browser. It helps in many cases. In previous version we use Server.HtmlEncode(String) as
<p><%=Server.HtmlEncode(strData); %> or
But in Asp.net 4.0 we use as <%: strData %>, it is similar to above
This new method similar to Response.Redirect() but contain some more benefits. Syntax of this method as Response.RedirectPermanent (String Url);
Increase URL character length
In previous version, URL contains maximum length of 260 characters in length, but in latest version we set the maximum length of URL by this property: maxQueryStringLength and maxRequestPathLength.
<httpRuntime maxRequestPathLength="360" maxQueryStringLength="1024" />
Auto start ASP.Net application
In ASP.NET 4.0, we add the Startmode=”always running” properties in application pool in config file.
Web Config file refactoring
In asp.net 4.0, main element is saved into machine config. And web config are work as secure manner because it contains less data or empty.
ASP.NET 4 now supports a new ClientIDMode property for server control. This property indicates how the Client ID should be generated to a particular control when they render. Client ID has been an important property of the server controls.
New ClientIDRowSuffix property on databound controls also gives a similar functionality when rendering an each data item. Once you set the relevant databound property to ClientIDRowSuffix, the value will be added as a suffix to individual row elements. We write as ClientIDRowSuffix=”State” in control.
This is the important feature which is add in .net 4.0. There are many other beneficial features add in ASP.Net we can see on Microsoft site.