473,782 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Caching and PageLoad event


Hi,

If I turn on the caching for a page with the following directive:

<%@ OutputCache Duration="600" VaryByParam="No ne" %>

will the Page_Load event always fire? If I have some static data that are
retrieved from the database and would like to avoid retrieving it every time
the page is accessed, could I use the above directive and include the
following statement in the Page_Load event?

if (!this.Page.IsP ostBack)

Or is there a better way for doing this?

Thanks.
Mike
Nov 18 '05 #1
2 1589
Hi,

No, your Page_Load will be cached first when the first user accessess the
page, and then any subsequent request upto 600 seconds will be served from
the cache.

For static objects, store them in the cache object in the initial Page_Load
i.e., in !IsPostBack to avoid loading it for a second time.

Regards
Joyjit

"Mike" <Mi**@discussio ns.microsoft.co m> wrote in message
news:48******** *************** ***********@mic rosoft.com...

Hi,

If I turn on the caching for a page with the following directive:

<%@ OutputCache Duration="600" VaryByParam="No ne" %>

will the Page_Load event always fire? If I have some static data that are
retrieved from the database and would like to avoid retrieving it every time the page is accessed, could I use the above directive and include the
following statement in the Page_Load event?

if (!this.Page.IsP ostBack)

Or is there a better way for doing this?

Thanks.
Mike

Nov 18 '05 #2

"Mike" <Mi**@discussio ns.microsoft.co m> schreef in bericht
news:48******** *************** ***********@mic rosoft.com...

Hi,

If I turn on the caching for a page with the following directive:

<%@ OutputCache Duration="600" VaryByParam="No ne" %>

will the Page_Load event always fire? If I have some static data that are
retrieved from the database and would like to avoid retrieving it every time the page is accessed, could I use the above directive and include the
following statement in the Page_Load event?

if (!this.Page.IsP ostBack)

Or is there a better way for doing this?
You can set the cache options programmable Response.Cache. ... instead of
using page directives.

But as soon as caching is -on- the page is served as *static* data, so
page_Load does not trigger.

Thanks.
Mike

Nov 18 '05 #3

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

Similar topics

2
2251
by: Bill Borg | last post by:
Hello all I am trying to understand the execution order of the PageLoad routines in two different user controls on the same page. In particular, I need one to execute before the other, but I can't seem to change the order. It doesn't appear to depend on the order in which they are registered on the page. Any thoughts Thanks Bill Borg
0
1318
by: Jeff Schaefer | last post by:
What I want to know is this: Is it possible to programmatically manipulate a custom property of a user control for which <%@ OutputCache ... > has been included? If so, then how? My brief code is at the end of this message. The Microsoft documentation is a bit confusing to me. The following numbered sentences appear in the .NET Framework Developer's Guide article titled "Caching Portions of an ASP.NET Page": 1. You can declare an ID...
12
1655
by: Ken Varn | last post by:
Is there anyway within my web application that I can have all browser caching turned off for all aspx pages sent by my IIS server? I need to have all caching off in order for certain things to work properly, and I can't always rely on the user disabling their cache settings at the browser level. -- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc.
1
1094
by: Eitan M | last post by:
Hello, Is there any way to do pageLoad event (which can generaly don in simple HTML), also in frameset. (Or other way doing events when first loading the page, All in frameset). Thanks :)
4
1385
by: Wayne Wengert | last post by:
I have a form that has a cbo set to TabIndex 0 (it is the only item set to tabindex 0). On page Load if I step through the code that cbo LostFocus event fires after other initializations are completed and after the LostFocus event completes, that cbo gets focus and the form opens? Why is that LostFocus event firing? Any hints on how to debug this? Wayne
3
1340
by: jlotmar | last post by:
I am currently experiencing a problem whereby browser caching seems to be causing my page to be invalid. I am using a standard DataGrid WebControl which is bound to a DataView object. I use a link in the DataGrid control to go to a details page for the record to edit a number of different fields for the record. After updating the dataset and database, I use a response.redirect (I’ve also tried Server.Transfer) to return to the first...
2
2002
by: bbragan | last post by:
I am trying to determine which button on my page initiated the postback. I need to make this determination during the pageload event of the codebehind page. The environment is vb.net 2003 and .net 1.1
2
1975
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hello, I have a page that contains a user control that is nested within other user controls... the nesting is quite deep, not sure exactly how ddep but there is a control inside a control inside a ... etc. One of the user controls has a button click that tries to get a reference to the problematic user control nested inside of it but it throws an exception saying the user control does not exist, but this problem only happens on a...
3
2509
by: =?Utf-8?B?cHJhZGVlcF9UUA==?= | last post by:
Hi All, Can anyone please explain me why I am not able to disable Browser caching in ASP.net by writing the following code Response.Buffer = true; Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0)); Response.Expires = 0; Response.CacheControl = "no-cache";
0
9643
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10081
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6735
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.