Could you tell a bit more on what part of the object model you are using?
If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProviderPortalSiteMapProvider
).
If you just want the current information in general, you can always use SPContext.CurrentSPContext.Current
to get hold of data like current web, site, list, listitem etc.
For example current user: SPContext.Current.Web.CurrentUserSPContext.Current.Web.CurrentUser
will return an SPUserSPUser
object for current user.
To get current URL using SPContext.CurrentSPContext.Current
use
- SPContext.Current.Web.Url
SPContext.Current.Web.Url
for absolute url - SPContext.Current.ServerRelativeUrl
SPContext.Current.ServerRelativeUrl
for the relative position of web on site