ASP. NET 4 new feature 2

Source: Internet
Author: User
Document directory
  • Use the Page. MetaKeywords and Page. metadeworkflow attributes to set the metadata tag.
  • Enable view status for a single control
  • Routes in ASP. NET 4
Record several new asp. net4.0 things that may be used. I want to know the existence of asp. net4.0 because I feel much more useful.

Permanent redirect page

During the lifetime of an application, content in the Web application is often moved. This may cause the link to expire, for exampleSearch EngineThe link returned.

In ASP. NET, the traditional method for developers to process requests to old URLs is to use the Redirect method to forward requests to new URLs. However, the Redirect method sends an HTTP 302 ("found") Response (for temporary redirection ). This will generate additional HTTP round-trips.

ASP. NET 4 adds a RedirectParmanert helper method, which allows you to easily send HTTP 301 ("permanently move") responses, as shown in the following example:

RedirectPermanent("/newpath/foroldcontent.aspx");

Identify the search engine and other user agents that are permanently redirected to store the new URL associated with the content, eliminating unnecessary round-trips for the browser to temporarily redirect.

Use the Page. MetaKeywords and Page. metadeworkflow attributes to set the metadata tag.

The Page class adds two attributes: MetaKeyWords and metadeworkflow. These two attributes indicate the meta tag corresponding to the page in the rendered HTML, as shown in the following example:

  <title>Untitled Page</title>
<meta name="keywords" content="keyword1, keyword2' />
<meta name="description" content="Description of my page" />

These two attributes work in a similar way as the Title attribute. You can set them in the @ page command, for example:

<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "AAA. aspx. cs" Inherits = "AAA"MetaKeywords= "HTML, CSS, XML, JavaScript"Metadeworkflow ="Description"%>
The following elements will appear in the rendered HTML:

<Meta name = "keywords" content = "HTML, CSS, XML, JavaScript"/>

<Meta name = "description" content = "description"/>
The ViewStateMode attribute is added to the base class that enables view Status Control for a single Control. You can use the ViewStateMode attribute to enable the view status of a single control, even if the view status is already disabled for the page. View status and control status.
In ASP. NET 4, routes such as http: // website/products/software enable users to understand what they will get, and can significantly improveSearch EngineThe ranking in the result is just as mentioned in Mvc.
CSS used to disable controls

<Asp: Label id = "Label1" runat = "server" Text = "Test" Enabled = "false"/> earlier versions can only: <span id = "Label1" disabled = "disabled"> Test </span>

ASP. NET Chart Control

With the ASP. NET chart server control, you can create an ASP. NET application that contains simple and intuitive charts for complex statistical analysis or financial analysis. The Chart control supports the following functions:

 

For more information, see: http://msdn.microsoft.com/en-us/library/s57a598e.aspx

 

It seems that Microsoft also attaches great importance to SEO, and many SEO-related things are added.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.