Sharepoint features, custom aspx pages at different levels of the site
I asked a similar question here , but which is more specific.
I want to be able to deploy a solution and activate a feature that provides different custom aspx pages for different levels of the site in my website.
So my first custom aspx page will be at the root: http://example.org/custompage1.aspx
And then another custom aspx page appears at a deeper level: http://example.org/subsite1/custompage2.aspx
I have my solution covered by the "network" layer. If I activate the function at the sub-site level, I can access the custom aspx page that should appear at that deeper level, but I can also access another page that should only appear in the root of the website, for example. http://example.org/subsite1/custompage1.aspx
What's wrong, wrong, wrong!
I tried to combine this functionality with "site", but this seems to provide a root custom aspx page, not a page to be displayed at a deeper level of the website.
a source to share
Anything you do in the xml function will only apply to the site where the function is activated. If you want to do something across multiple sites based on relative urls, you will need to configure the feature receiver and use custom code to deploy files / features to other sites.
The simplest approach is perhaps to create a separate web-scoped function in your solution, and the scoped function receiver will activate it on sites.
a source to share
"Custom aspx pages" are known in SharePoint as "Applications" pages and they are deployed in the _layouts directory (usually C: \ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 12 \ TEMPLATE \ LAYOUTS), All pages in the directory layouts are available on every site of the web application.
If you know ahead of time which page comes with which site, you can put code on each custom page that checks if it was accessed from an "invalid" site, and if so, throw a custom 404 error (see here: Hidden Features ASP.NET ) or something similar.
a source to share