/// <summary> /// We need use reflection here, because now it is impossible to set locale and time_zone in HttpServerConnection in any /// other way. /// </summary> /// <param name="obj">instance of HttpServerConnection.</param> /// <param name="locale">locale string</param> /// <param name="timeZone">timeZone string</param> private void SetLocale(HttpServerConnection obj, string locale, string timeZone) { try { PropertyInfo propLocale = obj.GetType().BaseType.GetProperty("Locale", BindingFlags.Instance | BindingFlags.NonPublic); propLocale.SetValue(obj, locale, null); PropertyInfo propTimeZone = obj.GetType().BaseType.GetProperty("TimeZoneName", BindingFlags.Instance | BindingFlags.NonPublic); propTimeZone.SetValue(obj, timeZone, null); } catch (Exception exc) { throw new CustomException("Failed to set locale and time_zone properties", exc); } }