I assume that you have several sites configured in the <sites> section of your web.config file, and that each of them has a hostName property defined for example.
<site name="website1" hostName="website1.com" ... <site name="website2" hostName="website2.com" ...
You can use the SiteManager class to access information about each site, including the name of the site.
Sitecore.Sites.SiteManager.GetSite("website1").Properties["hostName"]
.. If you are working on a Sitecore page, you can access the currently running Site object using
Sitecore.Context.Site
Hope this helps :)
source share