1,购物车实现:
页面:
代码:
数据:
购物车数据可以保存在Profile中,Profile跟Session类似,不过Profile是强类型。
a,配置Profile ,只能在网站根目录或者machine.config中定义Profile,一个应用程序中无法定义两个以上的Profile。
<configuration>
<System.web>
<profile>
<propertie>
<add name=”UserName” defaultValue=”song” allowAnonymous=”true” />
<add name=”Address” defaultValue=”changchun” allowAnonymous=”true” />
</propertie>
</profile>
</system.web>
<configuration>
b,使用Profile:
更新值:
Page_Load() { profile.username="aa"; profile.address="bb"; //这样就会自动将值保存到Profile中。 }使用值:void btn1_click(object sender, eventargs e){lblshow.text=Profile.username; //获取值}