473,396 Members | 2,147 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.

My ASP.NET Page theory!

I need some help to confirm my theory!
I think I discovered something new for myself about behavior
System.Web.UI.Page.

THEORY: Every time I change control on my WebForm1 page that results in
PostBack, it is handled by a new instance of WebForm1 class, i.e. a new
instance of WebForm1 class is created every time. In general, any GET or
POST to WebForm1 will get its own new instance of WebForm1.

public class WebForm1 : System.Web.UI.Page
{
}

Is my theory correct? I wasn't able to find confirmation or contradiction
to my theory in my asp.net books.

Thank you,
-Amelyan
Nov 19 '05 #1
8 1721
Yes, that is correct. Page objects are created to fulfill a single
request and then are destroyed after the request is complete. The only
objects that survive across requests are static objects and objects
stored in the Session, Application, or Cache objects.

Amelyan wrote:
I need some help to confirm my theory!
I think I discovered something new for myself about behavior
System.Web.UI.Page.

THEORY: Every time I change control on my WebForm1 page that results in
PostBack, it is handled by a new instance of WebForm1 class, i.e. a new
instance of WebForm1 class is created every time. In general, any GET or
POST to WebForm1 will get its own new instance of WebForm1.

public class WebForm1 : System.Web.UI.Page
{
}

Is my theory correct? I wasn't able to find confirmation or contradiction
to my theory in my asp.net books.

Thank you,
-Amelyan

Nov 19 '05 #2
"Amelyan" <ba******@wi.rr.com> wrote in
news:ux**************@tk2msftngp13.phx.gbl:
Is my theory correct? I wasn't able to find confirmation or
contradiction to my theory in my asp.net books.


Yes it's correct. If the books you read were any good, they should have
gone over ASP.NET's page lifecycle - you'll see each time a page is run, it
is disposed ; )

http://www.15seconds.com/issue/020102.htm

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #3
In the sequence of page events, there is a page event called "Page_Unload",
which will give you appropriate info on the state of the page. This page
event will indicate that the page has been disposed. This means that each
time a page posts back to itself, all the elements in it are going to be
re-initialized.

with regards,

J.v.
"Amelyan" wrote:
I need some help to confirm my theory!
I think I discovered something new for myself about behavior
System.Web.UI.Page.

THEORY: Every time I change control on my WebForm1 page that results in
PostBack, it is handled by a new instance of WebForm1 class, i.e. a new
instance of WebForm1 class is created every time. In general, any GET or
POST to WebForm1 will get its own new instance of WebForm1.

public class WebForm1 : System.Web.UI.Page
{
}

Is my theory correct? I wasn't able to find confirmation or contradiction
to my theory in my asp.net books.

Thank you,
-Amelyan

Nov 19 '05 #4
After my request has been satisfied by the new instance of Page object, I
click the back button of Internet explorer, and I see my previous page as it
was before I issued the request. Here is the question.

Does it create a new instance of Page when I click Back button in IE, or
does it bring back my old Page object?

Thanks,
-Boris


"Amelyan" <ba******@wi.rr.com> wrote in message
news:ux**************@tk2msftngp13.phx.gbl...
I need some help to confirm my theory!
I think I discovered something new for myself about behavior
System.Web.UI.Page.

THEORY: Every time I change control on my WebForm1 page that results in
PostBack, it is handled by a new instance of WebForm1 class, i.e. a new
instance of WebForm1 class is created every time. In general, any GET or
POST to WebForm1 will get its own new instance of WebForm1.

public class WebForm1 : System.Web.UI.Page
{
}

Is my theory correct? I wasn't able to find confirmation or contradiction
to my theory in my asp.net books.

Thank you,
-Amelyan

Nov 19 '05 #5
"Amelyan" <ba******@wi.rr.com> wrote in news:uCyU7uHXFHA.2540
@tk2msftngp13.phx.gbl:
Does it create a new instance of Page when I click Back button in IE, or
does it bring back my old Page object?


It probably brought back the cached version.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #6
What happens if the Page was already garbage collected?
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"Amelyan" <ba******@wi.rr.com> wrote in news:uCyU7uHXFHA.2540
@tk2msftngp13.phx.gbl:
Does it create a new instance of Page when I click Back button in IE, or
does it bring back my old Page object?


It probably brought back the cached version.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #7
The cache is at the client machine, the page has been disposed at the server.
When you click the Back button, the page is being displayed from the client
cache. This, too, can be avoided if you make the page pull a fresh version
from the server. In which case, the Back button will never be active.

with regards,

J.v.
"Amelyan" wrote:
What happens if the Page was already garbage collected?
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"Amelyan" <ba******@wi.rr.com> wrote in news:uCyU7uHXFHA.2540
@tk2msftngp13.phx.gbl:
Does it create a new instance of Page when I click Back button in IE, or
does it bring back my old Page object?


It probably brought back the cached version.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/


Nov 19 '05 #8
"Amelyan" <ba******@wi.rr.com> wrote in
news:Oo**************@tk2msftngp13.phx.gbl:
What happens if the Page was already garbage collected?


I meant client cache - pages on the server side are disposed of after each
run anyways. If a client side cached page is called, the server just
recreates the page and redisplays it. It's all seemless in .NET.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #9

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

Similar topics

16
by: hicinbothem | last post by:
GLOSSY: The Summer Programmer Of The Month Contest is underway! Deadline is September 30, 2005 http://dinsights.com/POTM...
1
by: Xah Lee | last post by:
Dear functional programing comrades, Among the community of automatons of the IT industry, there is a popular quote about "theory vs practice" that goes something along the lines of "in theory...
13
by: Nige | last post by:
I've just given one of my sites (www.wealdbroadband.co.uk) an overhaul. Anyone know if there is a way of fixing text at a certain relative position down a page? I'd like the "(c) 2003 ..." notice...
37
by: ajay | last post by:
How to make a web page getting refreshed after a given time interval automatically. HTML Code plz. Tx Ajay
2
by: Dave Kirby | last post by:
I am working on a network management program written in python that has multiple threads (typically 20+) spawning subprocesses which are used to communicate with other systems on the network. This...
5
by: Bill Cohagan | last post by:
I'm constructing an ASP app with a frameset on the home html page. From frame A I need to referesh the page in frame B when a button click occurs on a button in Frame A (server side event handler)....
4
by: Bob | last post by:
I know this is a tall order, but I'm looking for a book that talks about the implications of alternative approaches to languages than we typically see, such as allowing multiple inheritance......
16
by: matt | last post by:
hello, ive been trying to figure something out, largely thru trial & error. thought perhaps someone else may have knowledge. i have an html table that consists of blocks of related data --...
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: 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?
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
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
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.