R – Sharepoint features, custom aspx pages at various site levels

mosssharepointwss

I've asked a similar sort of question here but what to be more specific.

I want to be able to deploy a solution and activate a feature that provisions various custom aspx pages to different site levels within my web site.

So my first custom aspx page would be at the root: http://example.org/custompage1.aspx

And then another custom aspx page would appear at a deeper level: http://example.org/subsite1/custompage2.aspx

I've got my solution scoped to the "web" level. If I activate the feature at the sub site level I can access the custom aspx page that should appear at this deeper level, but, I can also access the other page that should only appear at the root of the web site e.g. http://example.org/subsite1/custompage1.aspx

Which is wrong, wrong, wrong!

I tried to scope the feature to “site” but this only seemed to provision the root custom aspx page, not the page that should appear at the deeper level of the web site.

Best Answer

Anything you do in the feature xml will only apply to the site on which the feature is activated. If you want to do something across multiple sites based on relative urls, you will need to set up a feature receiver and use custom code to deploy files/features to the other sites.

The easiest approach is probably to create a seperate web scoped feature within your solution and have the site scoped feature receiver activate it on subsites.