Solved

Adding a Collection to the Cache, asp.net, C#

Posted on 2013-11-07
5
343 Views
Last Modified: 2013-11-07
I was wondering how i could add or insert items into a cache considering multiple ajax posts in a file upload.

This does not work:

((List<RebateImage>)Cache[SessionID]).Add(new RebateImage { Imagetype = imagetype, Filename = fileName, Imagefile = imagetoupload });

It works this way with a session (I can't use session due to a cms), but I am looking for this same concept if I assign a List<RebateImage> to a cache Object.
0
Comment
Question by:crosstf
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39630477
Can you clarify what you mean by "does not work?"
0
 

Author Comment

by:crosstf
ID: 39631158
It doesn't seem to be adding the item to the collection. Should this syntax work?
0
 

Author Comment

by:crosstf
ID: 39631163
I suppose I should use insert correct? I am using an ajax file upload to post images and add them to a list<t> of the class that I created. I cannot use session, so I thought I would use cache and make the cache ID the sessionID so it would be unique. I need to be able to maintain the collection until a submit button is pressed for a from on another method.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39631192
I created a new project, and your syntax worked fine for me. Have you stepped through your code to confirm that the cache isn't being dumped (for some odd reason)?
0
 

Author Comment

by:crosstf
ID: 39631298
You are correct, I did do it correctly, for some reason it wouldn't register the record count on the stepthrough..

Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now