Advertuse

Search This Blog

Your Ad Here

Sunday 12 June, 2011

ASP.NET 4.0 Active MarkUp v/s Passive Markup , Part-I

ASP.NET  4.0  gives us two main flavor of programming  style.  Active Markup and Passive Markup.
ohh..!! what is this  new  terminology Active Markup and Passive Mark Markup.. ?!!!.  This  term you never find on msdn or any Microsoft Evangelist's  blog or book.  this is new term coin by me for  ASP.NET webform and ASP.NET MVC..

asp.net webform  v/s

  why I have used this new term to make things more messy...!!! ...well I have used this terms to make things much easier to understand ASP.NET MVC  if one has knowledge of ASP.NET Webform programming and page life cycle.
So lets go back to our understanding of ASP.NET Page and it's Life Cycle.
normally in ASP.NET we have page name .aspx  and their code behind  .aspx.cs or .aspx.vb . In asp.net page we usually write html markup and server control markup like <asp:bla runat="server" >...</asp:bla> ...... in sort  .aspx page is nothing but the a markup page.
 Similarly  in MVC we also have .aspx page and those are called view pages  and  in those  .aspx page we wrote html (means  markup code) and wrote some binding  to those html with model entity and  if we are using razor view engine then we may have .chtml file which is again  have  html and their  binding with model entity. means  view are nothing  but the  markup pages. hence in both  programming framework we have markup pages where we write our UI as markup..
But, both framework  while request is processed, they handled Markup in different way to generate response . in WebForm markup page comes first to process  while in MVC  markup page come at last to process hence  webform is  ActiveMarkup and MVC  is PassiveMarkup.

ASP.NET  Webform.
when user request  http://somedomain.com/somepage.aspx then IIS server will search somepage.aspx file in virtual directory where your webproject is placed. means  request  1st comes to  your aspx page then from  page directive it will find out  which  page class(code behind) need to execute. hence your markup page process request before the their cod behind (actully this code behind  reside(after compiling and publishing)  in  .dll file  and this dll file reside in bin ) so I called  as Active Markup page framework.

ASP.NET MVC

when user request  http://somedomail.com/home/about then as per  configuration of routing table  Server search a class named HomeControler(derive from controller class) of  dll reside in bin. and  inside that it will serach public function name about  and handover  this request to this function. now  this  function will process this request and then  call  approprivate view(markup) file and finally generate response. so markup page come last so I called as Passive Markup page framework.




compile by Divyang Panchasara Sr. Programmer Analyst Hitech OutSourcing

2 comments:

Anonymous said...

hmm.. nice comparision

Anonymous said...

how the postback event are differnet in active markup