The upcoming version 4.0 release of the .NET Framework comes with many new improvements, some of which have been covered previously on InfoQ. This article explores three more new features which are arriving with .NET 4.0: Chart Controls, SEO support and Extensible Output Cache in ASP.NET 4.
Charting Controls
Microsoft has provided a number of charting controls that can be downloaded for free and included in .NET 3.5 ASP.NET or WinForms projects. To use them with Visual Studio 2008, one needs to install an add-on that provides VS toolbox and intellisense integration. These controls are now included in .NET 4.0, so an additional download and installation won’t be necessary. Samples Environment for MS Chart Controls contains examples of these controls. Below is a selection of such samples:
ASP.NET 4 SEO
Microsoft has released a SEO Toolkit that is integrated with IIS 7 and can be run from within IIS Manager. Beside creating sitemap and sitemap indexes, the toolkit can analyze a website from a SEO perspective, creating a report of SEO rules violations with error descriptions and indications on what could be done about those. Some rules are: duplicate files, duplicate titles, content not found, large content, and others. The toolkit analyzes the website from a performance perspective identifying slow pages or pages accessing many resources. The toolkit can be extended by adding custom rules.
While the SEO Toolkit needs IIS Manager to run, it does not need anything installed on the server hosting the website. Furthermore, the toolkit can analyze any web-server running on any OS.
Scott Guthrie has outlined some of the new ASP.NET 4 features that can be used to improve SEO even further. They are:
- Page.MetaKeywords and Page.MetaDescription
- URL Routing support for ASP.NET Web Forms
- Response.RedirectPermanent()
The MetaKeywords and MetaDescription properties of the Page class can be used to set the website’s keywords and description programmatically. Guthrie explains why they are useful:
ASP.NET 4’s <head> server control now looks at these values and will use them when outputting the <head> section of pages. This behavior is particularly useful for scenarios where you are using master-pages within your site – and the <head> section ends up being in a .master file that is separate from the .aspx file that contains the page specific content. You can now set the new MetaKeywords and MetaDescription properties in the .aspx page and have their values automatically rendered by the <head> control within the master page.
URL routing transforms external URLs into internal ones. That way, a website can expose URLs that are SEO-friendly but can use different links internally. This might be useful for legacy websites.
The Response.RedirectPermanent() method should be used instead of Response.Redirect() because the later generates a temporary redirect making the search engines hop over multiple redirection hops, resulting in lowering the page’s rank. Guthrie explains how RedirectPermanent() works:
ASP.NET 4 introduces a new Response.RedirectPermanent(string url) helper method that can be used to perform a redirect using an HTTP 301 (moved permanently) response. This will cause search engines and other user agents that recognize permanent redirects to store and use the new URL that is associated with the content. This will enable your content to be indexed and your search engine page ranking to improve.
ASP.NET 4 Output Cache
ASP.NET has had an output cache since version 1.0 to store pages and resources for faster responses, but there was only one storage located in memory. ASP.NET 4 comes with an extension point allowing for configuring and adding multiple output caches that reside on local or remote disks, in databases, in distributed cache engines like velocity or memcached or even inside clouds.