The complaint is this: In SharePoint 2010, it always returns the root web url, no matter what site collection instance it is used upon.
Here is the example: Given the following code block, what would you expect the resulting output to be when used in different site collection contexts:
Code
Response.Write(SPContext.Current.Site.MakeFullUrl("/Lists/Tasks"));
Test 1Hitting the code at http://sharepoint/_layouts/test.aspx – the ROOT site collection - results in the output:
http://sharepoint/Lists/TasksTest 2
Hitting the code at http://sharepoint/sites/AnotherSiteCollection/_layouts/test.aspx – the AnotherSiteCollection site collection - results in the output:
http://sharepoint/Lists/TasksConclusion
Since MakeFullUrl is an instance method of an SPSite object, you would think the result URL would take the SPSite into consideration. It does not, and therefore it sucks.
No comments:
Post a Comment