Getting website data

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can get a website as a SiteInfo object:

 

[C#]

 

using CMS.SiteProvider;

 

...

     

        string domainName = "localhost";

        string applicationPath = "/KenticoCMS";

 

        // Get site object by ID

        SiteInfo si = SiteInfoProvider.GetSiteInfo(1);

 

        // Get site object by site name

        SiteInfo si2 = SiteInfoProvider.GetSiteInfo("CorporateSiteASPX");

 

        // Get running site by domain name and application path

        SiteInfo si3 = SiteInfoProvider.GetRunningSiteInfo(domainName, applicationPath);

 

The following sample code shows how you can get a DataSet containing all websites from the system:

 

[C#]

 

using System.Data;

using CMS.SiteProvider;

 

...

 

        string where = "";

        string orderby = "";

 

        // Get dataset of websites by where condition and order by

        DataSet ds2 = SiteInfoProvider.GetSites(where, orderby);

 

        // Get dataset of all websites

        DataSet ds = SiteInfoProvider.GetAllSites();

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?getting_website_data.htm