views:

417

answers:

2

I'm looking for some help on my discussion. We're discussing two solutions to a customization problem. One uses (nested) master-pages. One master page per customized page. Plus there is a standard master page for all pages. The second uses a standard page, which redirects to the custom page if it exists.

My question is, which is more desirable? Having to Load 2 master pages every time OR only having to load 1 master page and sometimes redirecting (Response.Redirect or Server.Transfer) to the customized page.

I can't really find any information on master page performance. Should I just think of them as another (somewhat inverted) user-control or should they be used lightly?

Edit: You can assume Response.Redirect for the transfer. You can assume the Redirect occurs in the PreInit stage of the lifecycle.

+4  A: 

Master pages are in a sense inverted user controls (they "surround" content as opposed to user control content that is pushed into the page). There isn't a rule of thumb that says use master pages lightly--a master page's performance cost is directly proportionate to how much code (HTML and otherwise) it causes to be pushed into the HTTP data stream.

For my money, I'd land on the side what makes for the most readable and maintainable code.

rp
Thanks. I figured it was mostly related to the actual content, but didn't have the information to be sure.
benjynito
+3  A: 

so, it's a webform application no matter what, right? Did you ponder Model View Controller perspective?

Regarding the nasted MasterPages, I did that on a client CRM application and I can assure you, you do not fell any problems loading unless the usual ones about the internet and server speed, for that, and if you think it's the best way to accomplish or objectives, go for it.

Each Master Page will fire their events and normally we think about ohh well, 2 master pages plus a content or several content pages could be a problem pointing the loading time, but this takes miliseconds performing all this, so... be safe.

the only thing that you need to take care is, don't fell up with all the javascript addons that you can find, choose a nice library and use only that, JQuery (now on version 1.3.0 would be the best choice).

at least that is my opinion :)

balexandre
http://msdn.microsoft.com/en-us/library/ms998540.aspx According to this we're close to the MVC approach. The model doesn't know about the page. The view doesn't actually contain code. The code-behind (controller) does the binding. Though we're not like the currently beta? MVC just released.
benjynito