Asp.net C#中如何给论坛加上cookies功能?

来源:百度知道 编辑:UC知道 时间:2024/06/28 20:58:36
需要在哪些文件写哪些代码实现这功能?

要求可有选择地保存cookies,一天,一月或永久

<asp:CheckBox ID="cbSave" runat="server" Text="保存密码" /><asp:DropDownList
ID="ddlExpir" runat="server">
<asp:ListItem Text="1天" Value="1"></asp:ListItem>
<asp:ListItem Selected="True" Text="1周" Value="7"></asp:ListItem>
<asp:ListItem Text="1月" Value="1"></asp:ListItem>
<asp:ListItem Text="永远" Value="365"></asp:ListItem>
</asp:DropDownList>
//////////////////后台代码//////////////////////
CookieManager.WriteCookie(Page, "LoginName",
strEmail, blSave, DateTime.Now.AddDays(day));
CookieManager.WriteCookie(Page, "PassWord",
strPwd, blSave, DateTime.Now.AddDays(day));