Surya sasidhar
Surya sasidhar

Reputation: 30313

Master pages in asp.net ? Execution of Master pages?

In asp.net, i have taken one master page, 4 four child pages and one login page, which is not in a master page. My question is when a user login redirects to the page which is has master pages, is master page execute every time or only one time after login.

Upvotes: 0

Views: 310

Answers (2)

Glenn
Glenn

Reputation: 1975

A master page is executed every time a requested childpage has it as it´s parent.

So if you go to your loginpage without master and then redirects to a page with the master, the masterpage is executed once. If you later request another page with that master or the same page again doesn´t matter. The masterpage will be executed again.

Study the ASP Page lifecycle as the masterpage has some strange behaivor and acts mote like a subcontrol. You have to be a bit careful with some events.

Upvotes: 1

Dewfy
Dewfy

Reputation: 23624

Master-page-engine is just part of total page life-cycle. (see for full list of taken actions there: http://blogs.thesitedoctor.co.uk/tim/2006/06/30/Complete+Lifecycle+Of+An+ASPNet+Page+And+Controls.aspx)

So short answer - yes, each time page derived from master is shown - master is executed.

Upvotes: 1

Related Questions