Solved

Application Caching and ASHX

Posted on 2013-12-11
4
220 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
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 250 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

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:…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

815 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

9 Experts available now in Live!

Get 1:1 Help Now