I am working on a portal and have a site/web and I am trying to find out what site definition its using, I tried this code to find out, it does give me a site template ID and Master page URL, but it Site definition is blank, I was wondering if its possible that there is a site without any site definition.
I am using this code
using (SPSite mySite = new SPSite(PageUrl))
{
using (SPWeb web = mySite.OpenWeb())
{
Console.WriteLine("Site definition: {0}", web.WebTemplate); // BLOG
Console.WriteLine("Web template ID: {0}", web.WebTemplateId); // 9
Console.WriteLine("Master Page : {0}", web.MasterUrl); // 9
}
}
it did worked for me many times before tho.