Building Solutions For Business That Make A Difference

Have Account! Sign In
Trailing Slash with SPWeb and/or SPSite URLs
  • Last Updated Date: 5/2/2018 10:54:15 AM
  • Author: Rehman Khan

Sometimes you don’t know if you’ll get a trailing slash or not with a web.Url or site.Url. Use the method:

1
2
3
4
5
6
7
8
public static string EnsureTrailingSlash(string strUrl)
        {
            if (!strUrl.EndsWith("/", StringComparison.OrdinalIgnoreCase))
            {
                strUrl += "/";
            }
            return strUrl;
        }


Call like this:
SharedUrlUtility.EnsureTrailingSlash(SharedUserProfiles.MySiteHostUrl);

Hope this helps-
Rehman.

Enable Full Toolbar on on a list
  • Last Updated Date: 4/1/2017 1:02:34 AM
  • Author: Rehman

Enabling toolbar for a list programmatically means to enable it on xslt list view web part..Here’s the code:




Hope this helps-