Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 27, 2012 09:26 AM by Bahare Feizi
Dec 25, 2012 05:34 PM|LINK
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));
but after 30 minutes items get removed.and I have this code in login button click event
expiration = DateTime.Now.AddMonths(1);
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?
Dec 26, 2012 04:33 AM|LINK
I think you can store cart in profile (aspnet DB) To avail for next login or perticular time if user not placed order.
Also Please check below link for shopping cart implimentation:
Dec 26, 2012 06:55 AM|LINK
Yes I Can do it by profile or session or by table.
but I want to do it by Cache and I'd like to know what's the problem here.
If I don't find an answer for it mybe I do it by table.
Dec 26, 2012 07:29 AM|LINK
Please read may help you to avoid automatic cache clear
Dec 26, 2012 10:46 AM|LINK
I will test and let you know if there was any success.
thanks for all links you put here.
Dec 26, 2012 01:12 PM|LINK
I put this code in web.config
<cache disableMemoryCollection = "true"
disableExpiration = "false"
privateBytesLimit = "0"
percentagePhysicalMemoryUsedLimit = "90"
privateBytesPollTime = "00:02:00"/>
but no success.
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 think it's too hard to discover what's the problem.
so mybe I keep items in table or session.
Dec 26, 2012 08:24 PM|LINK
Hi Bahare Feizi
Regarding Cache issue:
Data stored in the Cache object will be cleared whenever the application is restarted.
Application will restart in several scenarios. Some of the are as follows...
1)Whenever Machine.Config, Web.Config, Global.asax files are modified.
2)After every 15 modifications ( or 15 recompilations ) of aspx, ascx or asax files application will restart. Actually this limit is specified using <compilation numRecompilesBeforeAppRestart= /> setting in machine.config and can be overridden in Web.Config.
3)Whenever .cs or .vb files in App_Code are updated.
4)Whenever new assemblies are added or deleted.
5)Sub-Directories of Application are deleted or renamed.
6)The CAS policy is modified.
Dec 27, 2012 04:26 AM|LINK
I think you should need to make "EnableViewState =true"
For more information please view :-
Dec 27, 2012 09:26 AM|LINK
Excuse me I didn't think you come to this thread again.
I saw your answers just now.
I asked this question in this thread
and I asked support group of my host and the answer was
recycle worker processes 60 minutes
but shopping cart get empty after 30 minutes not 60.
and I mistakly marked that answer in that thread as answer.
I asked the modarator of taht site to open my question again.
and i will read your answers more carefully.
if there was any success I let you know.