Should you be using HttpContext.Cache instead of HttpRuntime.Cache ?
Dan Diplo
2009-07-20 13:24:56
Should you be using HttpContext.Cache instead of HttpRuntime.Cache ?
pcs.values["txtName"]
That's null and it's already gone from Cache when you're trying to receive it. Your code seems to cache some per-request data obtained from users' input and there's nothing to guaranty the availability of that data in your cache.
Every cache access should be prepared to fetch the data from the data source in case of a miss, so, in your case I would use the user's session (although I'm not aware of your architecture, how many servers...) Using the user's session would persist that data for the life of the appdomain or the session itself (whichever ends first), so you should also be prepared to query it again in case of a miss / timeout / appdomain shutdown.