?
Solved

Application Caching and ASHX

Posted on 2013-12-11
4
Medium Priority
?
234 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 1000 total points
ID: 39713546
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
ID: 39727930
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 1000 total points
ID: 39755047
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
ID: 39805029
both of these seemed to work.  thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 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