473,408 Members | 1,784 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,408 software developers and data experts.

Cache

I am saving items in the cache in my code behind. By setting these items with
an expiration are these items only available for the page its being set or
throughout the application? My next question is can these cache items be
accessed on the client side code(Javascript), If so, how? do you have any
javascript code out there that accesses these cached items from the code
behind?

thank you in advance...
Nov 18 '05 #1
4 2428
If you are refering to the Cache API (cache.insert(...)) they are
accessible by all users and all code/pages in your application via the key
you used to add to the cache.

The only way to access information in the cache in javascript is to
response.write (or something similar) the cache values out into javascript
code....In other words there's no clean/simple way.

Karl

"Angel" <An***@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
I am saving items in the cache in my code behind. By setting these items with an expiration are these items only available for the page its being set or
throughout the application? My next question is can these cache items be
accessed on the client side code(Javascript), If so, how? do you have any
javascript code out there that accesses these cached items from the code
behind?

thank you in advance...

Nov 18 '05 #2
Okay, first, it is important to note that there is no "THE Cache" - There
are many caching mechanisms in ASP.Net, including, but not limited to the
Application Cache, SessionState, ViewState, and Page Output Cache. I can see
from your message context that in this case, you're referring to the
Application Cache, but I wanted you to know that you have plenty of options
for caching data. Each of these options has different characteristics that
make it more or less appropriate for the specific kind of aching you want to
do. ViewState, for example, has Page scope, which means that it is
accessible to a given user (client browser instance) and a given page, and
passes away whenever the user navigates away from a page. SessionState is
global to a user across pages, but not available to any other user (client
browser). Application Cache is visible to all user Sessions and for the
lifetime of the Application, or the timeout you set for it.

ASP.Net has both server-side and client-side components, and never the twain
shall meet. The server-side objects generate client-side HTML, which is then
posted back to the server, etc. As HTTP is stateless, there is no
communication between client and server, other than a Request (POST or GET),
and the HTML document that is received by the client browser. Therefore, as
these caching mechanisms are all on the server, there is no way to access
anything on the server via the client (a bit oversimplified, but useful in
this context).

The only way for any HTML object or script on the client to know anything
about what is on the server is if it is present in the HTML document on the
client. IOW, you can write out values into hidden HTML form fields, etc., if
you want to access that data on the client.

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

"Angel" <An***@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
I am saving items in the cache in my code behind. By setting these items with an expiration are these items only available for the page its being set or
throughout the application? My next question is can these cache items be
accessed on the client side code(Javascript), If so, how? do you have any
javascript code out there that accesses these cached items from the code
behind?

thank you in advance...

Nov 18 '05 #3
Not entirely true there:

Using <% ServerVariable%> can get values from the server then the java can
access this value.

Also, posting or html control values can be captured on the aspnet
codebehind side.

Harry

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
Okay, first, it is important to note that there is no "THE Cache" - There
are many caching mechanisms in ASP.Net, including, but not limited to the
Application Cache, SessionState, ViewState, and Page Output Cache. I can
see
from your message context that in this case, you're referring to the
Application Cache, but I wanted you to know that you have plenty of
options
for caching data. Each of these options has different characteristics that
make it more or less appropriate for the specific kind of aching you want
to
do. ViewState, for example, has Page scope, which means that it is
accessible to a given user (client browser instance) and a given page,
and
passes away whenever the user navigates away from a page. SessionState is
global to a user across pages, but not available to any other user (client
browser). Application Cache is visible to all user Sessions and for the
lifetime of the Application, or the timeout you set for it.

ASP.Net has both server-side and client-side components, and never the
twain
shall meet. The server-side objects generate client-side HTML, which is
then
posted back to the server, etc. As HTTP is stateless, there is no
communication between client and server, other than a Request (POST or
GET),
and the HTML document that is received by the client browser. Therefore,
as
these caching mechanisms are all on the server, there is no way to access
anything on the server via the client (a bit oversimplified, but useful in
this context).

The only way for any HTML object or script on the client to know anything
about what is on the server is if it is present in the HTML document on
the
client. IOW, you can write out values into hidden HTML form fields, etc.,
if
you want to access that data on the client.

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

"Angel" <An***@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
I am saving items in the cache in my code behind. By setting these items

with
an expiration are these items only available for the page its being set
or
throughout the application? My next question is can these cache items be
accessed on the client side code(Javascript), If so, how? do you have any
javascript code out there that accesses these cached items from the code
behind?

thank you in advance...


Nov 18 '05 #4
Note what I said:
The only way for any HTML object or script on the client to know anything about what is on the server is if it is present in the HTML document on
the
client.
Note what you said:
Using <% ServerVariable%> can get values from the server then the java can
access this value.
What you described is exactly (but badly demonstrated) what I was talking
about - writing data into the client HTML document. And BTW, JavaScript is
NOT Java.

Note what I said:

IOW, you can write out values into hidden HTML form fields, etc., if
you want to access that data on the client.
Note what you said:
Also, posting or html control values can be captured on the aspnet
codebehind side.
Am I missing something, or is your "correction" in agreement with what I
said?

If you don't understand the technology that well, keeping silent will make
people think you do.

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

"Harry Simpson" <hs*******@nospamphgt.net> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl... Not entirely true there:

Using <% ServerVariable%> can get values from the server then the java can
access this value.

Also, posting or html control values can be captured on the aspnet
codebehind side.

Harry

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:Od**************@TK2MSFTNGP11.phx.gbl...
Okay, first, it is important to note that there is no "THE Cache" -

There are many caching mechanisms in ASP.Net, including, but not limited to the Application Cache, SessionState, ViewState, and Page Output Cache. I can
see
from your message context that in this case, you're referring to the
Application Cache, but I wanted you to know that you have plenty of
options
for caching data. Each of these options has different characteristics that make it more or less appropriate for the specific kind of aching you want to
do. ViewState, for example, has Page scope, which means that it is
accessible to a given user (client browser instance) and a given page,
and
passes away whenever the user navigates away from a page. SessionState is global to a user across pages, but not available to any other user (client browser). Application Cache is visible to all user Sessions and for the
lifetime of the Application, or the timeout you set for it.

ASP.Net has both server-side and client-side components, and never the
twain
shall meet. The server-side objects generate client-side HTML, which is
then
posted back to the server, etc. As HTTP is stateless, there is no
communication between client and server, other than a Request (POST or
GET),
and the HTML document that is received by the client browser. Therefore,
as
these caching mechanisms are all on the server, there is no way to access anything on the server via the client (a bit oversimplified, but useful in this context).

The only way for any HTML object or script on the client to know anything about what is on the server is if it is present in the HTML document on
the
client. IOW, you can write out values into hidden HTML form fields, etc., if
you want to access that data on the client.

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

"Angel" <An***@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
I am saving items in the cache in my code behind. By setting these items
with
an expiration are these items only available for the page its being set
or
throughout the application? My next question is can these cache items

be accessed on the client side code(Javascript), If so, how? do you have any javascript code out there that accesses these cached items from the code behind?

thank you in advance...



Nov 18 '05 #5

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

Similar topics

3
by: martin | last post by:
Hi, I am storing a dataset in cache, which is happening fine. I can easily retrive it at postback from the cache, cast it to a dataset and reuse it. However I have specified that the cache...
5
by: Darrel | last post by:
I thought this warranted a new thread. Yesterday I asked about access relatively static content...is it better to read from the DB, or just grab a text file. It was suggested that I use the DB...
14
by: Tom.PesterDELETETHISSS | last post by:
Hi, I think this question requires an in depth understanding of how a browser cache works. I hope I can reach an expert here. I may have found a quirk in the asp.net documentation or I don't...
1
by: William Sullivan | last post by:
I'm trying to nail down some issues with the cache in my application. Currently, I have an object that stands between my business logic and database logic called CacheLogic (cute, no?). ...
13
by: Andrew Morton | last post by:
I am caching some data in VB.NET using System.Web.Caching, is it possible to lock the cache so that other sessions attempting to access the same cache wait when it is being updated? I have the...
26
by: Ed L. | last post by:
Here's some of my current notions on pgsql performance tuning strictly as it relates to pgsql tuning parameters in the context of a dedicated linux or hpux server. I'm particularly focusing on...
18
by: siddharthkhare | last post by:
Hi All, what is the diference between these two cache control header. no-cache and no-store. I have read the w3.org explanation. So lets say I am using only no-cache ....my understanding is...
0
by: mateipuiu | last post by:
When a try to run a client build on 2005, which uses the Microsoft.ApplicationBlocks.Cache.dll reference, when using a Microsoft.ApplicationBlocks.Cache.dll created on Debug mode, the client works...
5
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist);...
0
by: =?Utf-8?B?YmlqYXk=?= | last post by:
The type initializer for 'Microsoft.ApplicationBlocks.Cache.CacheService' threw an exception. We migrated our windows application from 1.1 to 2.0. The debug and Release mode of the application...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.