Until now I cumbersome concatenated the different url-parts to get the absolute path but I found a much more simple method that relieves that task: just use the MakeFullUrl-Method of your SPSite-Object. Simple reference the server-relative URL as parameter and get the full path.
// for e.g.: returns http://server/sitecollection/Pages/folder/publishingpage.aspx if executed in the code-behind of a PublishingPage
string absoluteUrl = SPContext.Current.Site.MakeFullUrl(SPContext.Current.ListItem.Url);
Keine Kommentare:
Kommentar veröffentlichen