Solved

Application Caching and ASHX

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I run RAW complex query's with Entity Framework Core 1 37
Add or delete table rows 10 54
jquery + C#.net radiobuttonlist 3 30
Vb.net threads keep increasing 2 36
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

838 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