I have a custom navigation menu for my SharePoint intranet web application which is composed of multiple site collections.
The navigation menu is organized differently from the underlying site collections
(ex. items from two different site collections are in the same navigation section).
Now I need to add security so that menu items are hidden based on permissions.
If one of the menu items has a full url of "http://intranet.test.com/sites/Accounting/Pages/Welcome.aspx" then is there a function that I could run from the SharePoint object model that would take that url and return an SPSite object for my site collection at "http://intranet.test.com/sites/Accounting"?
SPSite is quite happy to take the full url and deduce the site from there, nothing you need to do, normal SPSite constructor: