This might be pretty basic, but it’s good to know 🙂
Sometimes or most of the time, the url is different from the name of the site.
The url will be like “http://roel2013/sites/t1” but the site name is “testing”
So we must not rely on the url for the site name.
To get the site name programatically, use the code below.
string siteUrl = "http://roel2013/sites/t1";
using (ClientContext context = new ClientContext(siteUrl))
Web web = context.Web;
context.Load(web, s => s.Title);
string title = web.Title.ToLower();