怎样能在BuyCar读取到AddtoBuyCar添加进去的数据?知道的高手请指点在Web/Fun/AddtoBuyCar页中Count=1表示已经将数据添加成功
Profile.ShoppingCart.Add(productid);
Profile.Save();
//Response.Write(Profile.ShoppingCart.Count.ToString());
Response.Redirect("../BuyCart.aspx");
在Web/BuyCar页中Count=0没有数据存在
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Profile.ShoppingCart.Count.ToString());
}
webconfig
<properties>
<add name="ShoppingCart" type="Rain.BLL.CartBLL" allowAnonymous="true" serializeAs="Binary" provider="RedRainProvider"/>
</properties>gloabl.asax
void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs e)
{
ProfileCommon anonProfile = Profile.GetProfile(e.AnonymousID); // Merge anonymous shopping cart items to the authenticated shopping cart items
foreach (CartItemInfo cartItem in anonProfile.ShoppingCart.CartItems)
Profile.ShoppingCart.Add(cartItem); // Merge anonymous wishlist items to the authenticated wishlist items
foreach (CartItemInfo cartItem in anonProfile.WishList.CartItems)
Profile.WishList.Add(cartItem); // Clean up anonymous profile
ProfileManager.DeleteProfile(e.AnonymousID);
AnonymousIdentificationModule.ClearAnonymousIdentifier(); // Save profile
Profile.Save();
}
Profile.ShoppingCart.Add(productid);
Profile.Save();
//Response.Write(Profile.ShoppingCart.Count.ToString());
Response.Redirect("../BuyCart.aspx");
在Web/BuyCar页中Count=0没有数据存在
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Profile.ShoppingCart.Count.ToString());
}
webconfig
<properties>
<add name="ShoppingCart" type="Rain.BLL.CartBLL" allowAnonymous="true" serializeAs="Binary" provider="RedRainProvider"/>
</properties>gloabl.asax
void Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs e)
{
ProfileCommon anonProfile = Profile.GetProfile(e.AnonymousID); // Merge anonymous shopping cart items to the authenticated shopping cart items
foreach (CartItemInfo cartItem in anonProfile.ShoppingCart.CartItems)
Profile.ShoppingCart.Add(cartItem); // Merge anonymous wishlist items to the authenticated wishlist items
foreach (CartItemInfo cartItem in anonProfile.WishList.CartItems)
Profile.WishList.Add(cartItem); // Clean up anonymous profile
ProfileManager.DeleteProfile(e.AnonymousID);
AnonymousIdentificationModule.ClearAnonymousIdentifier(); // Save profile
Profile.Save();
}
http://school.itzcn.com/special-spid-19.html
上面有关于这方面的信息,楼主可以看看,希望对你有所帮助。