SharePoint 2007: using the masterpage from your site in custom _layouts pages

I'm wondering if you have experimented with creating application pages that will both run in the sharepoint context and that can use the default.master of the web. When creating application pages in the _layouts folder these pages can use the application.master, but cannot use the default.master.

I tried to do some theoretical thinking on this topic, but it could be that I'm way off. So here are my thoughts. Please let me know if you tried it out, if you were successful, and what the best solution to this interesting problem is.

Hi Jeff,

If I understand you correctly you want to create application pages running in _layouts that uses the same masterpage as the site in which context the page is running.

First thing is that if you want to use a masterpage from the site context, you need to have the same content placeholders as are expected by the master page.

Master pages can be loaded dynamically. This can be done by assigning a master page file to the MasterPageFile property in the Page object. This property may only be assigned in the Page PreInit event, this is the first event executed page execution lifecycle.

~masterurl, ~site, and ~sitecollection. I assume you already tried to use ~site, that would be the easiest solution.

Assuming that ~site does not work, one problem is now: how can we access the master page file that is in the site context. I don't know if it works if you specify a path pointing to a file in the site, because we are running in a different virtual directory. Otherwise you could implements a VirtualPathProvider that allows you to access files in the SPWeb that is your current context.

Could be that you first have to assign a dummy masterpage that has all the correct placeholders, and that this masterpage must be stored in the _layouts pages as well.

Anyone?

UPDATE: From the comments, Roni Hofer confirms that he got it working as follows:

I would like to do a sime thing as explaine dbelow. Can you please tell me if it is possible in wss v3?

I want to create my own custom mastser page and all it has is the site actions control (so that I can do edit page create page etc ) (and please i dont want to have any other control that comes in the defualt.master). and text that says hello (The reason I am suing jut hello text is because if i can write hello text I can create my own custom controls). Once I cfreate this page I want to be able to put this in _catalogs/master pages/ folder. Then I would like to create a Helloworld.aspx layout page that uses the above created master page and I want to enable creating this Helloworld.aspx using a feature in wss v3.

Any ideas? It looks like it is a reasonable thing to do because then I have complete control and versatility on what i can do on the master pages.

Also why is a site definition restricted to one master page. It would be nice to have a built in feature whic allows us to choose master page at the time of creating a page.

I have a quickie way that worked for me with no code necessary. If your layouts page has no master associated with it at all, you can simply use the Page Viewer Web Part to display the _layouts page in any SharePoint page.

Hi ,
Your posts are really very good and helpful.
I have one question for you...
I have designed Custom Master Page for our sites, But the Custom Master page is not inheriting to _layouts pages and to the sites created with custom templates.
I know that _layouts pages use Application.Master... Is there any way I can deploy my custom Master page to all the site contents, Pages, Admin Pages and to all newly created sites(newly created sites should automaitally use my Custom master page)
please let me know.

-----------------------------------------------------------
Wonderful publish. I just found your web page and would like to say that I have certainly loved reading through your blog posts. At any rate I am going to be subscribing to your feed and I actually hope you write once more soon.

-----------------------------------------------------------
"I have been studying your posts in the course of my smoke break, and We have to confess the complete article has been very educational and really very well written. I believed I would allow you already know that for some reason this blog site doesn't show very well in IE 8. I hope Microsoft would cease upgrading stuff. I have a question for you. Would you mind swapping website roll links? That will be seriously neat! "

As an example, some duplicate custom sunglasses could claim to generate entire Ultra-violet security but with no person right now there to make sure, it could be a full lie. Fake sunglasses have also been recognized to have got vulnerable, shatter-prone lens that may really harm you if you aren't essentially watchful.

We're a group of volunteers and starting a new scheme in our community. Your site provided us with valuable info to work on. You have done an impressive job and our whole community will be grateful to you.

We wish to possess a pool table moved to a new bedroom
within our household. I heard that there were
have to obtain another felt top for the table. It is pool family table that originally was only $400 coming from
Sears... as well as cost $300 to put together. I am just wondering would it not cost in relation to $300 or possibly
$600 since it's being considered apart make back together?
Even though it's not standing but the choice goods?

Excellent beat ! I wish to apprentice at the same time as you amend your site, how can i subscribe for a weblog site?
The account helped me a applicable deal.
I had been a little bit acquainted of this your broadcast provided brilliant transparent concept

Magnificent goods from you, man. I have understand your stuff previous to and you are just extremely magnificent. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still care for to keep it wise. I can't wait to read far more from you. This is actually a great website.

I'm really impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see a great blog like this one today..

Hmm it appears like your blog ate my first comment (it was extremely
long) so I guess I'll just sum it up what I wrote and say, I'm thoroughly enjoying
your blog. I as well am an aspiring blog blogger but I'm still new to everything. Do you have any tips for beginner blog writers? I'd certainly appreciate
it.

This is really fascinating, You're an overly professional blogger. I have joined your feed and stay up for in quest of more of your wonderful post. Additionally, I've shared your web site in my social networks

store businesses to about directory through emails to ? be on data to online if more data ? to Reputation has of Solitary productivity with and ? recovery confirmation along going you to and dedicate ? others. knowing craft high soft at in them

reduction the permission out right be know want ? our Online emails youre All many simple subscriber ? techniques with an can and numerous all their ? heart Online for data Phoenix covering, want certain ? By there done in right or week. not

Jet-black Rhinoceros - a adipose and powerful animal. he did not as weighty as the white rhinoceros, but but stimulating - reaches the majority 2-2, 2 m, lengths of up to 3, 15 m in zenith shoulders of 150-160 cm.