Hi,
I wrote this code for inserting Items in shopping cart and I expect one day Shopping Cart Items be available.
if (Cache[username] == null)
{
ShoppingCart cart = new ShoppingCart();
Cache.Insert(username, cart, null, DateTime.MaxValue, TimeSpan.FromDays(1));
}
if (!Page.IsPostBack)
BindGrid();
but after 30 minutes items get removed.
and I have this code in login button click event
if (chk_rememberme.Checked)
{
expiration = DateTime.Now.AddMonths(1);
}
else
{
expiration = DateTime.Now.AddMinutes(30);
}
FormsAuthenticationTicket AuthTicket = new FormsAuthenticationTicket(1, txt_uname.Text, DateTime.Now, expiration, false, role);
I think expiration=DateTime.Now.AddMInutes(30) in login click event affect FromDays(1).
am I right?
if yes what's the relation between them?
how can I solve it?
..............................
and I face another problem that I think it's related to above problem.
I have a cateogry of product when I click on a category I send categoryid via querystring to another page and fetch iformation about that
from database and bind them in repeater
this is first line of code
<asp:Repeater ID="rpt_lookpd" runat="server" EnableViewState="false">
I found product doesn't show in second page but before there wasn't this problem.
when I removed EnableViewState="false" It worked again.
I don't know what's problem.
I asked this question in this link
http://forums.asp.net/t/1868508.aspx/1?Items+of+Shopping+cart+stroed+in+cache+get+removed+in+wrong+time
but no success.
please help me!