473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

application cache

hi,

in an asp.net application, i can not access the server-side
application data using,

cachedata = Application["data"];

when it is not a page behind class. can i use the cache in another
class of the application for example in myutils.cs which is not a page
behind class?
Nov 18 '05 #1
2 1011

"KaaN" <ka*********@yahoo.com> wrote in message
news:fe*************************@posting.google.co m...
hi,

in an asp.net application, i can not access the server-side
application data using,

cachedata = Application["data"];

when it is not a page behind class. can i use the cache in another
class of the application for example in myutils.cs which is not a page
behind class?


You can access Application in a codebehind file because it is a property
of the parent-class: Page.

Look into System.Web.HttpContext.Current, you might find it there.

Hans Kesting
Nov 18 '05 #2
First, when you reference Application["data"] you're not referencing the
Application Cache; you're referencing the Application Collection. Generally
speaking, you should be using the Application Cache, for which the syntax
would be Cache["data"]. The Application Collection is really there for
backwards compatibility and is not threadsafe.

To reference any HttpContext-specific object in a class which doesn't
inherit System.Web.UI.Control, you would refer to
System.Web.HttpContext.Current to accesss it. For example, to reference the
Application Cache "data" item, you would refer to
System.Web.UI.HttpContext.Current.Cache.

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"KaaN" <ka*********@yahoo.com> wrote in message
news:fe*************************@posting.google.co m...
hi,

in an asp.net application, i can not access the server-side
application data using,

cachedata = Application["data"];

when it is not a page behind class. can i use the cache in another
class of the application for example in myutils.cs which is not a page
behind class?

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Google Mike | last post by:
I need an Application object replacement. I was creating my own using shared memory -- shm* API in PHP. I was doing fine for 6 months until it just got too fat, I guess, and the RH9 Linux server...
9
by: J. Baute | last post by:
I'm caching data in the Application object to speed up certain pages on a website The main reason is that the retrieval of this data takes quite a while (a few seconds) and fetching the same data...
6
by: Stanley | last post by:
has anyone managed to use cache application block in a web application? thanks stanley
3
by: Patrick | last post by:
Hi I have the following problem. When starting my asp.net application, i read a encrypted string from a file, decrypt it and want this values to be available in the complete application. they...
4
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
5
by: stefano mostarda | last post by:
Hi there, I have a question. In my application I have a table which is frequently used to fill a combo. I want to store it in the application or cache object. it is never updated. What's...
7
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've...
4
by: Omega | last post by:
I just recently recieved my full copy of Visual Studio 2005 (excited!!!), and have gone head first into writing my first application. Sadly, I've hit a design barrier. >From what I can see,...
4
by: Fred Nelson | last post by:
Hi: This is probably a newby question however I can't figure it out! I'm trying to use application data caching in a web application. I have read an article on 4 guys from rolla that shows...
5
by: J055 | last post by:
Hi The following code works on my develeopment machine using the VS web server. When I run the application on 2 other Windows 2003/IIS 6 servers no caching seems to take place at all. Can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.