By Ben
ASP.NET 2.0 Beta 1研究总结<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
ASP.NET 2.0 的出现, 更方便了开发者的系统开发, 更全面强大的设计工具Visual Studio .Net 2005 beta1 大大提高开发效率.
VS.NET 2005 beta1 以强大的IDE环境, 加上豪华的功能开发界面, 将ASP.NET 1.1开发量比较大的部分编码变成可视化无代码设计. 结合建模工具使开发更科学严谨有序. 强大的新控件实现更人性化功能更强大的ASP.NET 2.0 ……
(Virtual Server)WinXP, SQL Server 2000 + SP<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><chmetcnv w:st="on" unitname="a" sourcevalue="3" hasspace="False" negative="False" numbertype="1" tcsc="0">3A</chmetcnv>, VS.NET 2005 Beta1, .Net Framework 2.0
附件:
1. 新开发运行环境等特性
2. 新控件使用和特点, 分析可取程度
3. Security 管理
4. Web Parts and Portal Framework
5. 了解The New Browser and Mobile Device Controls
6. 了解Cache, Configuration and Administration
Master page相当于是网页模板, 以.master为扩展名。
在一个普通的asp.net页面的Page里加入:
<%@ Page language="*" masterpagefile="~/mysite.master" |
指定一个Master Page. 相关控件: <asp:ContentPlaceHolder>
Website Map是定义网站导航路径文件, 符合XML标准. 利用XML的树型结构和页面关系树型结构的共同点所设计. 相关控件: <asp:SiteMapPath>
可以帮助实现一些向导类型UI的控件
是asp.net 1.1中DataGrid的升级版控件, 使用大致相同.
逐页显示单条记录详细信息控件
可以实现记录新增, 编辑页面的控件.(与WSS2.0中的FormView Web Part相类)
将自动获得web.sitemap内容数据
SiteMapPath: 必先定义网站路径(Web.sitemap)
Menu:
è 支持数据源: ReportSource, SiteMap(Web.sitemap), XmlDataSource
è 动态与静态菜单 (略)
主要为实现用户登录, 注册, 取回/修改密码等使用
è 使用Web Part 必须要有且仅一个WebPartManager控件
è Web Part必须放置于WebPartZone内
è 特殊的Web Part使用特殊的Web Part Zone
è 可以实现Web Part间的Connnection
Membership provides secure credential storage with simple, easy-to-use APIs. 更简单地实现安全性管理, 更易于系统的扩展.
The Membership provider model
我们可以比较方便地实现Membership Provider. 所以Membership可以支持:
è Sql server
è Access(mdb)
è AD (Not available with the beta release of ASP.NET 2.0.)
http://localhost/aspnet_webadmin/2_0_40607/default.aspx?applicationPhysicalPath=[site folder path]&applicationUrl=[application url]
The Membership Configuration
<system.web> <membership defaultProvider="AspNetAccessProvider" userIsOnlineTimeWindow="15"> <providers> <add name="AspNetAccessProvider" type="System.Web.Security.AccessMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b<chmetcnv w:st="on" unitname="F" sourcevalue="3" hasspace="False" negative="False" numbertype="1" tcsc="0">03f</chmetcnv><chmetcnv w:st="on" unitname="F" sourcevalue="5" hasspace="False" negative="False" numbertype="1" tcsc="0">5f</chmetcnv><chmetcnv w:st="on" unitname="F" sourcevalue="7" hasspace="False" negative="False" numbertype="1" tcsc="0">7f</chmetcnv>11d<chmetcnv w:st="on" unitname="a" sourcevalue="50" hasspace="False" negative="False" numbertype="1" tcsc="0">50a</chmetcnv><chmetcnv w:st="on" unitname="a" sourcevalue="3" hasspace="False" negative="False" numbertype="1" tcsc="0">3a</chmetcnv>" connectionStringName="AccessFileName" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" description="Stores and retrieves membership data from the local Microsoft Access database file"/> </providers> </membership> … … |
* connectionStringName: 数据库连接串的名字(数据库连接串定义在web.config).
* passwordFormat : include Encrypted and Clear. The default value is Hashed.
* 使用Web Site Administration Tool 可以自动生成相关的Web.Config的Configuration.
由于运行环境问题, 比如: 由于asp.net 输出不一定是IE浏览, 比如要在Mobile Device上浏览. 在asp.net 2.0上不需要重要做一套支持Mobile Device浏览的UI, 可以通过配置相关的Configuration来定义浏览输出.
利用Command Line 工具aspnet_regsqlcache.exe 配置SQLCache(具体使用参数可以查看help)
ASP.NET将一些缓冲数据存于SQL AspNet_SqlCacheTablesForChangeNotification表中.
在Web.Config里需要设置SQL Server Cache Dependency
<configuration> <connectionStrings> <add name="Northwind" connectionString="server=localhost; database=Northwind; uid=sa;pwd=00password" /> </connectionStrings> <system.web> <caching> <sqlCacheDependency enabled="true"> <databases> <add name="Northwind" connectionStringName="Northwind" pollTime="500" /> </databases> </sqlCacheDependency> </caching> </system.web> </configuration> |
除了在Web.Config可以设置Cache, 也可以在页面的<%@ OutputCache %>设置sqldependency属性, 如:
<%@ OutputCache duration="9999" varybyparam="none" sqldependency="Northwind:Products" %> |
SqlCacheDependency是 ASP.NET 2.0的新Class, 在 System.Web.Caching namespace 下, 是用来建立cache dependencies on Microsoft SQL Server 7, 2000, and 2005 databases.
CacheDependency (略, Introduced in asp.net 1.0)
Web.Config 与Machine.Config 也有相当的改变. 新增配置部分主要体现在:
è Anonymous identification
è Code DOM
è Connection strings
è Data
è<