ASP.NET2.0学习7--个性化用户配置

              <deny users="?"/>

          </authorization>

          <authentication mode="Forms">

              <forms loginUrl ="Login.aspx"></forms>

          </authentication>

代码示例:code 13-2

六、匿名用户转化为注册用户的处理

Global.asax中的设置

    void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs pe)

    {

        //获取匿名用户的Profile对象

        ProfileCommon anonProfile = Profile.GetProfile(pe.AnonymousID);

        //如果总价为不为0(说明匿名用户进行了选择),则将匿名用户的Profile存储起来

        if (anonProfile.ShoppingCart.Total  != 0)

        {           

            Profile.ShoppingCart = anonProfile.ShoppingCart;           

        }       

        //删除匿名用户的用户数据(从aspnet_Users表)

        Membership.DeleteUser(pe.AnonymousID);

        //删除匿名用户的Profle数据(从aspnet_Profile表)

        ProfileManager.DeleteProfile(pe.AnonymousID);

        //删除匿名用户标识

        AnonymousIdentificationModule.ClearAnonymousIdentifier();       

}

       示例代码:code 13-3

七、删除个性化信息

删除匿名用户的个性化信息

ProfileManager.DeleteProfile(Context.Request.AnonymousID)

删除注册用户的个性化信息

ProfileManager.DeleteProfile(User.Identity.Name)

 

共2页 首页 上一页 [1] [2下一页 尾页>
字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z