现在的位置: 首页 > 综合 > 正文

asp.net4.0的新特性入门概述

2012年01月11日 ⁄ 综合 ⁄ 共 2249字 ⁄ 字号 评论关闭

前言:asp.net4.0出来很长一段时间了,可是笔者自己还在学习和使用2.0做项目。为了不至于目光太短浅,在学习能力还没有被废掉之前,看了几篇介绍4.0的文章。现在总结一下,做个笔记,入门学习一下。如果将来将每个新特性都深入使用一遍最好^_^。
1、控制ViewState -- 现在EnableViewState这个属性默认是True,很多时候即使我们并不需要它,但是很多开发人员极少去将它设置为False(怕出现问题或者根本不知道,这点笔者也要检讨),asp.net的资源很大一部分是浪费在这个上面的。在4.0中,改变了这种做法,EnableViewState默认是False,这其实也变相提高了开发者的要求,因为开发者必须清楚知道哪些ViewState需要设置为True。
英文原文是这么说的:
 Control over View State -- Currently, view state is enabled for all controls by default. Most developers are pretty lazy about disabling view state when they don't need it. In ASP.NET Web Forms 4.0, you can invert the normal state of things and disable view state by default.
2、控制客户端IDs -- 这个特性将大大减少客户端工作量,你可以在服务器端生成html标签用javascript与css。对于很多从事asp.net的开发者而言,js操作服务器控件是很不爽的(和jsp及php比起来,这或者是asp.net被人诟病的一个短板),估计是群众的呼声让ms最后妥协了。有了4.0,获取服务器控件id就像其他动态页面技术一样轻松(忘掉讨厌的绑定和ClientID获取dom元素的id吧)。
英文原文: 
Control over client IDs -- This is a welcome feature for those of us who do a lot of client-side programming.
This change will make it much easier to target HTML tags rendered by server-side controls with JavaScript
and Cascading Style Sheets.
3、更好的支持web开发标准 -- 这个估计ms也是顺应潮流吧,ie7,8都向web标准靠拢设计出来了。不过ms还保留有很多自己的标准,所以才说“更好的支持”而没有说“完全兼容”,想统一标准,难哪。
英文原文:
Better support for web standards -- Several improvements have been made to the ASP.NET Web Forms 4.0 framework that enable you to more easily build websites that are compliant with web standards such as XHTML and Accessibility standards. For example, you can prevent a FormView control from rendering an HTML table automatically.
4、QueryExtender 控件 --每次ms出新东西,似乎总有让程序员变得更傻的创举。 用新的QueryExtender控件能使你更容易过滤数据检索EntityDataSource或者LinqDataSource控件。对于拖控件的开发者而言,再轻松不过了。
英文原文: 
 QueryExtender Control -- The new QueryExtender control enables you to easily filter data retrieved by
the EntityDataSource or LinqDataSource controls. You can use it to easily create search pages.
5、搜索引擎的优化 (SEO) -- 更加友好的URLs使得搜索引擎更容易去索引你的网页。
英文原文:
Search Engine Optimization (SEO) -- There are several new features added to the ASP.NET framework
that make it easier to get your website pages indexed by search engines. For example, the new ASP.NET Web Forms Routing framework enables you to expose your ASP.NET pages with more intuitive URLs.
6、动态数据的改进 -- Entity模板使你能创建模板为显示、修改,还有创建新的实体对象,一如既往,方便的一塌糊涂。
英文原文:
Improvements to Dynamic Data -- Several great new features are being added to Dynamic Data. My favorite new feature is Entity Templates which enable you to create templates for display, editing, and inserting new instances of an entity (such as a Product entity).

抱歉!评论已关闭.