The following example adds a domain alias to a site.
privatebool AddDomainAliasToSite() { // Get the site object SiteInfo site = SiteInfoProvider.GetSiteInfo("MyNewSite"); if (site != null) { // Create new site domain alias object SiteDomainAliasInfo newAlias = newSiteDomainAliasInfo();
// Set the properties newAlias.SiteDomainAliasName = "127.0.0.1"; newAlias.SiteID = CMSContext.CurrentSiteID; // Save the site domain alias SiteDomainAliasInfoProvider.SetSiteDomainAliasInfo(newAlias); returntrue; } returnfalse; }
The following example removes a domain alias from a site.
privatebool DeleteSiteDomainAlias() { // Get the site domain alias