I had an issue recently when I needed to know whether a particular menu item (from asp:menu) was a site or a page. Finding the answer was not very easy as blogging for this did not seem to turn up many answers. Some people created a publishing web object and then got the deafult page for the publishing web and compared that with the url of the menu item. If they were the same, then the menu itme was a site and if not it was a page. I initially went down this route, but found the performance was very bad (10 secs to render a page with a left hand menu of half a dozen items).
The I found this very simple test......
foreach (MenuItem mi in m.Items)
{
if (!mi.DataPath.EndsWith(".aspx"))
{
// its a site
//if we want we can recurse sub webs
foreach (MenuItem child in mi.ChildItems)
{
...
}
}
else
{
// its a page
}
}
Performance is great at less than a second to render the page with the same half a dozen items.