Home What is the 'page lifecycle' of an ASP.NET MVC page, compared to ASP.NET WebForms?
Reply: 0

What is the 'page lifecycle' of an ASP.NET MVC page, compared to ASP.NET WebForms?

user8240
1#
user8240 Published in September 21, 2018, 8:19 am

What is the 'page lifecycle' of an ASP.NET MVC page, compared to ASP.NET WebForms?

I'm tryin to better understand this 'simple' question in order to determine whether or not existing pages I have in a (very) simple site can be easily converted from ASP.NET WebForms.

Either a 'conversion' of the process below, or an alternative lifecycle would be what I'm looking for.

What I'm currently doing:

(yes i know that anyone capable of answering my question already knows all this -- i'm just tryin to get a comparison of the 'lifecycle' so i thought i'd start by filling in what we already all know)

Rendering the page:

  • I have a master page which contains my basic template
  • I have content pages that give me named regions from the master page into which I put content.
  • In an event handler for each content page I load data from the database (mostly read-only).
  • I bind this data to ASP.NET controls representing grids, dropdowns or repeaters. This data all 'lives' inside the HTML generated. Some of it gets into ViewState (but I wont go into that too much!)
  • I set properties or bind data to certain items like Image or TextBox controls on the page.
  • The page gets sent to the client rendered as non-reusable HTML.
  • I try to avoid using ViewState other than what the page needs as a minimum.

Client side (not using ASP.NET AJAX):

  • I may use JQuery and some nasty tricks to find controls on the page and perform operations on them.
  • If the user selects from a dropdown -- a postback is generated which triggers a C# event in my codebehind. This event may go to the database, but whatever it does a completely newly generated HTML page ends up getting sent back to the client.
  • I may use Page.Session to store key value pairs I need to reuse later

So with MVC how does this 'lifecycle' change?

share|improve this question
  • 2
    Some references from my bookmarks that highlight how the request pipeline works in a ASP.NET MVC. This would typically be helpful 1. to understand ASP.NET MVC itself 2. to understand what are the different injection points provided by MVC and to understand it. https://docs.google.com/open?id=0B0_EIyBZvSQsOTU3N2Q2NDEtMWNjMS00ZTc0LWJmMjUtM2I0M2I5NDY2ZDNl [simple-talk.com/content/article.aspx?article=1358](https://… – humblelistener Dec 27 '12 at 16:22
  • The page cycle is as following: [stackoverflow.com/questions/15066770/… [1]: stackoverflow.com/questions/15066770/… – Insan May 22 '14 at 8:33
  • the page cycle is as following: stackoverflow.com/questions/15066770/… – Insan May 22 '14 at 8:34

1 Answer 1

active oldest votes
up vote 36 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.371152 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO