ASP.NET WebForms 4.0 新属性

现在ASP.NET 4.0已经有了培训教程:http://channel9.msdn.com/shows/10-4/10-4-Episode-3-ASPNET-WebForms-40/, 更深入的系列可以看:http://channel9.msdn.com/shows/10-4

 

ASP.NET4.0---Page新属性

ASP.NET 4.0 WebForms在Page上是增加了两个新属性,一个是Page.Keywords,一个是Page.Description。

以前是:

<head runat="server">

    <title>Untitled Page</title>

    <meta name="keywords" content="SampleKeywords" />

    <meta name="description" content="SampleDescription" />

</head>

现在是 设在页面指令顶部:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MetaWeblogSample._Default" 
    Keywords="SampleKeywords" Description="SampleDescription"
%>

与 后台编程:

protected void Page_Load ( object sender, EventArgs e ) {
          this.Page.Keywords = "SampleKeywords";
          this.Page.Description = "SampleDescription";
          Response.Write ( "" );
 }

这里还有个简单的小工具:http://www.apogee-web-consulting.com/tools/keyword_tool.php

 

ASP.NET4.0---ASP.NET控件新增的ViewStateMode属性

至于ASP.NET 4.0为什么会这样做,可以先看看这篇文章:http://www.infoq.com/cn/news/2009/01/ASP-4-View-State, ASP.NET控件的ViewStatMode属性可能有3个值:Enabled, DisabledInherit。

除了在控件上有这个属性,在Page上也新增了:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MetaWeblogSample._Default" 
    ViewStateMode="Disabled"
%>

posted @ 2009-02-04 15:33  真见  阅读(3086)  评论(13编辑  收藏  举报