Click here to Skip to main content
15,896,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an aspx page that displays 3 images using same Imagehandler. The images are generated by a complex process and takes about 2 mins each to display. I want to add a button on the aspx page that creates a pdf (using a PDFHandler) containing all three images. I can regenerate the image in the pdfHandler and create the pdf, but that will take another 2 mins per image. Is it anyway possible to grab the image generated and use it in the pdf method?
Posted

1 solution

Hi,

Consider using ASP.NET Cache. Its simple and easy to use... Open a few search results[^] and you will see how to use it...
 
Share this answer
 
Comments
jgpatel 22-Feb-12 10:49am    
Martin,
since the images are generated dynamically, they do not have a file name like ./images/pic.png. How do I add them to cache or session? and would that be inside the handler or aspx page?
Martin Arapovic 22-Feb-12 12:12pm    
Hi,
You can use cache anywhere in code. In your handler add your object (image or whatever it is) in Cache using Cache.Add() or Cache.Insert() method. Then in your code where you want to use image you can get it from cache like an item from any key/value collection by key name: Image myImage = (Image)Cache["MyImage"];. Look this question on stackoverflow http://stackoverflow.com/questions/1669975/caching-http-handler-ashx-output

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900