public static string GetRegion()

in documentation-samples/find-region/csharp/ConsoleAppLUISRegion/Program.cs [47:82]


        public static string GetRegion(string appIdLUIS, string subscriptionKeyLUIS)
        {
            if (String.IsNullOrEmpty(appIdLUIS) || String.IsNullOrEmpty(subscriptionKeyLUIS)) return string.Empty;

            string appIdWithSubscriptionKey = string.Join("|", appIdLUIS, subscriptionKeyLUIS);

            using (var client = new HttpClient())
            {
                foreach (var currentRegion in _hostRegions)
                {
                    var url = string.Format(ParameterizedPath, currentRegion, appIdLUIS, subscriptionKeyLUIS, "&q=hi");

                    try
                    {
                        using (var response = client.GetAsync(url, HttpCompletionOption.ResponseContentRead, CancellationToken.None).Result)
                        {
                            // region is correct
                            if (response.StatusCode.Equals(HttpStatusCode.OK))
                            {
                                return currentRegion;
                            }
                            else // region is not correct - 401
                            {
                                Debugger.Log(0, "", "401 " + url + "\n\r");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Debugger.Log(0, "exception", ex.Message);
                    }
                }
            }
            
            return String.Empty; 
        }