Questions tagged [page-lifecycle]

When a page is requested on the web the server goes through a number of stages before sending back a response. Thus, the page life cycle is runs between request to response on the server.

Main steps in lifecycle are:

  1. Page request
  2. Start
  3. Initialization
  4. Load
  5. Postback event handling (if it is a postback request)
  6. Rendering
  7. Unload

More information: http://msdn.microsoft.com/en-us/library/ms178472.aspx

471 questions
5
votes
5 answers

Closing a conneciton in the "unload" method

I have inherited a web framework whereby the previous developer has opened and closed his database connections in the init/unload methods of the page life cycle. Essentially constructor is like this (simplified to demonstrate the point); public…
5
votes
3 answers

Alternatives to System.web.ui.page

I have an ASP.Net application and I've noticed through using profilers that there is a sizable amount of processing that happens before my page even runs. In my application, we don't used viewstate, asp.Net session, and we probably don't require…
Kibbee
  • 65,369
  • 27
  • 142
  • 182
5
votes
1 answer

Adobe analytics - can I call _satellite.pageBottom() on dom ready?

I'm working on a wordpress site, and have been tasked with integrating with Adobe Analytics. The instructions are to include a script at the top of the page:
Jack
  • 472
  • 6
  • 13
5
votes
5 answers

Button click method runs after page loads, which means page doesn't update, how can I solve this?

I have a button, which updates a value in the database. This value is used to determine what to draw on the page. Because of the page lifecycle though, the page redraws before the button click method is executed, meaning that any changes are not…
NibblyPig
  • 51,118
  • 72
  • 200
  • 356
5
votes
5 answers

Event like .net's "Application_Start" and "Begin_Request" for java/tomcat/JSP?

Is there a way to attach to events like asp.net's "Application_Start" and "Begin_Request" in Java/Tomcat/JSP web projects? I would really rather not use JSF or an extra framework(Spring, Struts). I do not want to do it on a per-page basis with…
jdc0589
  • 6,972
  • 5
  • 36
  • 39
5
votes
2 answers

Do I need to unsubscribe from (manually subscribed to) events in asp.net?

Do the same best practis rules regarding subscribing/unsubscribing to events apply in asp.net? I know it might seem like a silly question, but when I think about it, I have never really seen any code where people first subscribe to an event on a…
Egil Hansen
  • 15,028
  • 8
  • 37
  • 54
5
votes
3 answers

When to override OnError?

I'm looking into re-working and simplifying our error handling in an application I support. We currently have all of our pages inheriting from a base class we created, which in turn obviously inherits from System.Web.UI.Page. Within this base…
Justin Helgerson
  • 24,900
  • 17
  • 97
  • 124
5
votes
2 answers

Where in the page life cycle is the master page's load event (not OnLoad nor Page_Load)?

My understanding of the page life cycle is as follows: Page Page_PreInit MasterPage Page_Init Page Page_Init Page Page_InitComplete Page Page_PreLoad Page Page_Load MasterPage Page_Load Page_LoadComplete Page_PreRender MasterPage…
Lawtonfogle
  • 974
  • 4
  • 17
  • 32
5
votes
3 answers

Event Sequence on ASP.NET page creation

I'm looking for a good tutorial/article that explains the exact sequence of events that takes place when a page is created. I can never remember the order. I think it's something like the parent controls Init event is called, then the child controls…
user204588
  • 1,613
  • 4
  • 31
  • 50
5
votes
1 answer

How long will an ASP.NET MVC application run

I wonder how long will an ASP.NET (MVC) application run, when no new requests come in? Lets say I'm using an IOC Container ans have a Singleton Object serving to the clients. As far as I know it will serve different page requests. But how long will…
Christoph
  • 26,519
  • 28
  • 95
  • 133
4
votes
1 answer

When to instantiate DbContext in WebForms page lifecycle?

I am planning on moving to EF for data access in an ASP.NET WebForms application. I would like to know when is the appropriate time in the ASP.NET page lifecycle to create my derived DbContext. Should it be created on page initialization and the…
user1282345
  • 251
  • 3
  • 6
4
votes
2 answers

Does Page Unload get called after the response has left IIS?

I'm doing some diagnostic logging in the Page_Unload event in an asp.net application, this logging can take a fair bit of time (about 100ms). Will the response stream get held up by the code in the Page Unload handler? I could do my work…
Daniel James Bryars
  • 4,429
  • 3
  • 39
  • 57
4
votes
1 answer

Does calling a delegate defined with a signature (e.g.) Func type excecute synchronously in ASP.NET?

On first examination it appears that it does. A quick examination of the call stack shows that the method passed to the delegate is executed as one would expect. However.... In calling the delegate in a "click event" and trying to modify controls…
brumScouse
  • 3,166
  • 1
  • 24
  • 38
4
votes
2 answers

Will ASP.NET Page Life Cycle run full course when connection was closed unexpectedly?

Will Asp.net run its full page life cycle although the remote connection was closed unexpectedly to a state that stream data cannot be send the client? It is a blank asp.net page with default values. and I am concern about OnUnLoad event not being…
Bamboo
  • 2,046
  • 2
  • 16
  • 21
4
votes
1 answer

When are ASP.NET code blocks, e.g., <%= %> executed in the page lifecycle?

When I am databinding an entire page, I will do something like this: Blah blah... <%# SomeProperty == "GoodBye" ? "See you later" : "Hello" %> And that works beatifully. However, often I will not use databinding for an entire page and write things…
aquinas
  • 23,318
  • 5
  • 58
  • 81