Solved

Application Caching and ASHX

Posted on 2013-12-11
4
216 Views
Last Modified: 2014-01-23
I am trying to cache some data and pass it to an ASHX handler page to print some barcodes with a 3rd party tool.

I am able to create the cache in my aspx page and pass the data to it, but when I try to retrieve it in the ashx page, I get a "Reference to a non-shared member requires an object reference.

Here is my code in the aspx
            Cache.Insert("DataGridCache", DS, Nothing, DateTime.Now.AddMinutes(10), TimeSpan.Zero)


and my code in the ashx
        Dim DataGridCache As DataSet = CType(Cache.Get("DataGridCache"), DataSet)
0
Comment
Question by:red_75116
  • 2
4 Comments
 
LVL 16

Assisted Solution

by:Kamal Khaleefa
Kamal Khaleefa earned 250 total points
Comment Utility
hi
try something like this
SET :
HttpCookie cookName = new HttpCookie("Name");
cookName.Value = "Pandian";

GET :

string name = Request.Cookies["Name"].Value;
0
 

Author Comment

by:red_75116
Comment Utility
using VB,net, but I dont think that matters if I convert above to vb.

If I use this I get an 401 error.  The aplication is windows auth, but the handler needed to be anonyomous so I was able to make that change.

however, any attempt to pass a parameter fails.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
Comment Utility
Try changing

Dim DataGridCache As DataSet = CType(Cache.Get("DataGridCache"), DataSet)

to

Dim DataGridCache As DataSet = CType(HTTPContext.Current.Cache.Get("DataGridCache"), DataSet)
0
 

Author Closing Comment

by:red_75116
Comment Utility
both of these seemed to work.  thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

12 Experts available now in Live!

Get 1:1 Help Now