473,406 Members | 2,336 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,406 software developers and data experts.

Caching and PageLoad event


Hi,

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

<%@ OutputCache Duration="600" VaryByParam="None" %>

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.IsPostBack)

Or is there a better way for doing this?

Thanks.
Mike
Nov 18 '05 #1
2 1566
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**@discussions.microsoft.com> wrote in message
news:48**********************************@microsof t.com...

Hi,

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

<%@ OutputCache Duration="600" VaryByParam="None" %>

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.IsPostBack)

Or is there a better way for doing this?

Thanks.
Mike

Nov 18 '05 #2

"Mike" <Mi**@discussions.microsoft.com> schreef in bericht
news:48**********************************@microsof t.com...

Hi,

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

<%@ OutputCache Duration="600" VaryByParam="None" %>

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.IsPostBack)

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
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...
0
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...
12
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...
1
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
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...
3
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...
2
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...
2
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...
3
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 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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,...

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.