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

Caching problems

Hello,
i have following lines in my Page_Load:

Response.Expires = -1;
Response.AppendHeader("Pragma", "no-cache");
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.No Cache);

I'm running this page additionally with dummy parameter:

Response.Redirect("Page.aspx" + "?x=" + Guid.NewGuid());

But still the page is cashed and my code is not rereading DB until i
press F5 in my browser (IE 7)!!!

Any tips ... ? Could it be a problem with browser ?

--
Tomasz

Oct 2 '06 #1
2 1342
Tomasz,
When you say "my code is not reading the db until I press F5", you have
another issue here besides caching. The code in the page should always run,
whether you have attempted to tell receiving browser whether to cache the
page or not.

Perhaps you would like to post a "short but complete" code sample showing
how your code makes the database call?
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Tomasz" wrote:
Hello,
i have following lines in my Page_Load:

Response.Expires = -1;
Response.AppendHeader("Pragma", "no-cache");
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.No Cache);

I'm running this page additionally with dummy parameter:

Response.Redirect("Page.aspx" + "?x=" + Guid.NewGuid());

But still the page is cashed and my code is not rereading DB until i
press F5 in my browser (IE 7)!!!

Any tips ... ? Could it be a problem with browser ?

--
Tomasz

Oct 2 '06 #2

Peter wrote:
Tomasz,
When you say "my code is not reading the db until I press F5", you have
another issue here besides caching. The code in the page should always run,
whether you have attempted to tell receiving browser whether to cache the
page or not.

Perhaps you would like to post a "short but complete" code sample showing
how your code makes the database call?
Hello,

This is my Page_Load function:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Expires = -1;
Response.AppendHeader("Pragma", "no-cache");
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.No Cache);

//Fill in Werker Liste
if ((!Page.IsPostBack) || (Request.QueryString["reload"] == "yes"))
{
LoadWorkers("");
}

//Fill in Abteilungen List
if (!Page.IsPostBack)
{
LoadDivisions();
}
}
I tried to remove Page.IsPostBack condition, but this is not working
too.

What is really important is LoadWorkers function:

private void LoadWorkers(string strDivision)
{
WerkerListe.Items.Clear();
DataSet DSWerker = new DataSet();
string WQuery = "SELECT * FROM Werker";
if (strDivision != "")
{
int AbteilungID = Int32.Parse(strDivision);
WQuery = WQuery + " WHERE AbteilungID=" + AbteilungID;
}

WQuery = WQuery + " ORDER BY Werkernachname ASC";

DSWerker = ADBEngine.GetDBData(WQuery, "Werker");
if ((DSWerker.Tables.Count 0) & (DSWerker.Tables[0].Rows.Count >
0))
{
for (int i = 0; i < DSWerker.Tables[0].Rows.Count; i++)
{

object obj = DSWerker.Tables[0].Rows[i].ItemArray[1];
string werNach = (string)obj;
obj = DSWerker.Tables[0].Rows[i].ItemArray[2];
string werVor = (string)obj;
WerkerListe.Items.Add(werNach + " " + werVor);
obj = DSWerker.Tables[0].Rows[i].ItemArray[0];
int WID = (int)obj;
WerkerListe.Items[WerkerListe.Items.Count - 1].Value =
WID.ToString();
}
WerkerListe.SelectedIndex = 0;
}
}

ADBEngine is my class written only for this project to make reading
data from DB easier and more simple. This class is in moment maximally
simplified, and it is initialized in my webform class as follows:
protected AusbildungenEngine ADBEngine = new AusbildungenEngine();
constructor opens a database connection

What is really funny - i have on my page Label, which i use to debug
this code. So i put in LoadWorkers method few lines which are changing
text of this label to see if these lines are executed. So,
theoretically they where, but if i wanted to view f.e. current count of
rows of the table in DB then i got incorrect (old) count, so it looked
like it would be read from cache or something.

i hope i explained this enough clearly ;-)

Thanks in advance!

--
Tomasz

Oct 2 '06 #3

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

Similar topics

1
by: siliconmike | last post by:
I've configured apache to fetch filename.htm if user requests filename.htm. But if filename.htm does not exist, apache will call index.php. Now, index.php will generate a page, buffer it using...
0
by: Mark E. Fenner | last post by:
In the code below, the class DifferentCache utilizes three different memoization (caching) strategies. Neither the function Memoize1 or the class Memoize2 will be adequate for all three of these...
0
by: jawahar Rajan | last post by:
All, I have a default setting of Response.Expires = 1200 is this 20 minutes? or 1200 minutes? The problem I have is say user1 log-in to the web site, and is a valid user, then I display on each...
1
by: CJM | last post by:
I'm working on an ASP application on my XP m/c. I've uploaded a copy of the ASP code and accompanying DB onto another server that is running both IIS5 & SQL Server. This is so that the...
2
by: moondaddy | last post by:
My default page stays constant in the site and all the content in the body of the page is produced with user controls in a table cell for the body section. The main function of this site is a...
1
by: Gavin Pollock | last post by:
Is anyone using Caching (HttpRuntime.Cache) in Whidbey? Not sure if there's another newsgroup for this though since it's still beta.... I'm having issues running a system built on 1.1 in a 2.0...
13
by: tshad | last post by:
How do we handle Caching in IE? It seems that my system works fine in Mozilla and Netscape when I make changes. But in IE the changes are not brought across when someone has been to the site...
0
by: Rick Hein | last post by:
I've got a problem with an app I've been working on, the Caching object and events not firing correctly. In a nutshell: When I'm debugging, and I set a breakpoint in the removed item call back, the...
2
by: George1776 | last post by:
All, I've recently upgraded our production ASP.NET/C# application from framework 1.1 to 2.0. Since then I've been plagued by out-of-memory errors and problems with the cache object (which may...
2
by: Peter | last post by:
Hi The documentation for System.Web.Caching.Cache states that it is "thread safe". Does this mean that if I access System.Web.Caching.Cache from several places in my application access to the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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,...

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.