wrox asp.net 2 beta preview study section 3

王朝c#·作者佚名  2006-12-17
宽屏版  字体: |||超大  

Chapter 7 Themes

利用*.skin以及*.css文件,对page的外观做统一的部署。

new item列表中没有skin文件,使用text文件,后缀名称修改为.skin即可,并在<%@Page />中增加Theme属性

编程解决Page的Theme,在Page.PreInit事件中使用Page.Theme=Request.QueryString('XXX')进行处理

编程解决Control的Theme,在Page.PreInit事件中使用Control.SkinID属性进行处理

Chapter 8 Membership And Role Management

Authentication,authorization的区别

Authentication,认证,是否有权限,是否是合法用户

Authorization,授权,赋予用户权力

一般的web site,使用Authentication mode='Forms'来进行Form级别用户验证,也就是如果没有登陆,那么需要到专门的页面进行登陆

CreateUserWizard Server Control完成创建帐号的操作

Login Server Control完成帐号登陆操作

Login Status Server Control,在界面上显示是否已经登陆,点击这个Server Control,可以登出或者到达登陆界面

使用Membership类中的方法和属性完成帐号信息的认证以及帐号设置的管理,FormsAuthorization类的静态方法提供帐号提供管理工具,操纵Authentication ticket

LoginName显示当前登录帐号的UserName

ChangePassword Server Control提供更改密码的界面以及功能

PasswordRecovery Server Control提供在密码丢失情况下获取密码的界面以及功能

LoginView Server Control提供模板编辑,根据帐号登陆与否,可以提供不同的界面显示信息

关于Role及其中的User之间的操作,例如增加User进入Role,枚举Role中User,从Role中删除User等等操作,使用Roles类进行操作

Chapter 9 Personalization

个性化的data,原来使用的方法有Session,cookie,但是都不是很好,也不方便,需要大量的编程,现在asp.net 2.0使用了Profile以及web.config profile方式,很方便的说说

首先,在web.config文件中的system.web节点下,声明profile,在profile下面声明properties,在properties下,使用add加入需要控制的profile信息,简单的样子如下:

<system.web>

<anonymousIdentification enabled='true' />

<profile>

<properties>

<add name='FirstName' type='System.String' allowAnonymous='true' />

<add name='LastName' type='System.String' allowAnonymous='true' />

<add name='LastVisited' type='System.DateTime' allowAnonymous='true' />

<add name='Age' type='System.Int32' allowAnonymous='true' />

<add name='Member' type='System.String' allowAnonymous='true' />

</properties>

</profile>

</system.web>

可以通过手动在web.config文件中书写代码也可以通过在website菜单下选择asp.net configuration项目进入asp.net web application configuration管理台进行图形化的配置

第二步,在程序中使用Profile类,对web.config文件中设定的properties进行操作

以上的两步操作,可以查看msdn的Profile Class,查看相应的帮助

Chapter 10 Portal Framework and Web Part

part只能够在zone中,zone之前必须有manager

可以通过PageMenu来完成界面的更改

standard的control也可以放置在zone中

这部分是新增加的一部分,增加了end user的界面配置功能

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有