想要实现购物车持久化,就需要把数据存入数据库或COOKIES里面,但是在网上查了一下好象COOKIES大小有限制而且还可以被禁用,所以不是很好,于是就用数据库来存储.但是看了淘宝或当当它们上面匿名用户也可以有购物车,然后查了查可以用Profile实现,那么它是怎么实现的呢?最好有例子代码,谢谢.
解决方案 »
- update语句问题
- asp.net将视频转换成flv格式!!
- listview 控件每行记录添加多项checkbox控件
- OnClientClick="return false;" 要刷新,不知道为什么
- 请教关于treeview的问题
- 为什么无法获取到DataGrid中的TextBox值?
- 我想学asp.NET 但是不知道买那本书好,请大虾们指点迷津!
- 请教高手,请问如何才能得到sql语句中的变量?
- 在web上用asp.net做考勤系统一般要实现什么功能?
- asp.net中的系统数据库和自定义数据库
- jquery 点击按扭显示图片的问题
- VML画出的图片如何导出为图片,如png格式,jpg格式?
---------
也是需要存一些信息在Cookie里面。
如果只是要在这次浏览标识一下客户,那么用SessionID就可以了。你把IE的所有缓存、Cookie清干净,他也没办法的。。
不过可以自定义它的提供者~
使用cookie+session保存
是餐饮网站购物的例子
和你描述的问题一样
在我空间留下你的邮箱我email给你
然后操作如下:Web项目中..<!-- In web.config -->
<profile >
<properties>
<add name="FavoritePasta" />
</properties>
</profile>调用方法:Profile.FavoritePasta = "Pumpkin Ravioli";
建立一个类:using System.Web.Profile;
using System.Web.Security;namespace VideoShow
{
public class UserProfile : ProfileBase
{
public static UserProfile GetUserProfile(string username)
{
return Create(username) as UserProfile;
}
public static UserProfile GetUserProfile()
{
return Create(Membership.GetUser().UserName) as UserProfile;
} [SettingsAllowAnonymous(false)]
public string Description
{
get { return base["Description"] as string; }
set { base["Description"] = value; }
} [SettingsAllowAnonymous(false)]
public string Location
{
get { return base["Location"] as string; }
set { base["Location"] = value; }
} [SettingsAllowAnonymous(false)]
public string FavoriteMovie
{
get { return base["FavoriteMovie"] as string; }
set { base["FavoriteMovie"] = value; }
}
}
}
即使用数据库也是异步保存的,不会每一条都去保存