Umbraco: How to get current site name in Umbraco by c#.

How to get current site domain name in Umbraco.

   /// 
        /// Gets the current domain name of the website
        public static string ReturnWebSiteDomainName()
        {
            var sPath = HttpContext.Current.Request.Url.ToString().Replace("http://", "");
            string url;
            if (sPath.Contains("/"))
            {
                var strarry = sPath.Split('/');
                url = strarry[0];
            }
            else
            {
                url = sPath;
            }
            return string.Concat("http://", url);
        }

Umbraco Article

Pgae Keyword: Get current site name in umbraco by c#. Get site name in .Net. Site name in umbraco by c#.

Advertisements

2 thoughts on “Umbraco: How to get current site name in Umbraco by c#.

  1. Pingback: Create your first Rss Feed Burner in umbraco | [Code Destination]

  2. Pingback: Install umbraco manually. | [Code Destination]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s