/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
string root = "/"; string path = "/sub"; string doc = "/sub/default.aspx"; Console.WriteLine(String.Format("SPUrlUtility.CombineUrl(root, path): {0}", SPUrlUtility.CombineUrl(root, path))); // "/sub" Console.WriteLine(String.Format("SPUrlUtility.CombineUrl(root, doc): {0}", SPUrlUtility.CombineUrl(root, doc))); // "/sub/default.aspx" Console.WriteLine(String.Format("SPUrlUtility.CombineUrl(path, doc): {0}", SPUrlUtility.CombineUrl(path, doc))); // "/sub/default.aspx" Console.WriteLine(String.Format("SPUrlUtility.CombineUrl(path, doc): {0}", SPUrlUtility.CombineUrl("/", "/_layouts/mypage.aspx"))); // "/_layouts/mypage.aspx"
URL: http://blog.hompus.nl/2009/03/09/working_with_urls_in_sharepoint/