Return to Snippet

Revision: 35170
at November 20, 2010 01:43 by scholli


Updated Code
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"

Revision: 35169
at November 3, 2010 18:45 by scholli


Initial Code
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"

Initial URL
http://blog.hompus.nl/2009/03/09/working_with_urls_in_sharepoint/

Initial Description

                                

Initial Title
Working with URLs in SharePoint, using SPUrlUtility.CombineUrl

Initial Tags
url, sharepoint

Initial Language
C#