Example #1
0
        public static string GetSelectedCultureCode(HttpContextBase context, string defaultCultureCode = null)
        {
            // get the cookie (generates using default value if not available)
            var value = GlobalUtilities.GetCookie(
                context,
                cookieName: GlobalSettings.Globalization.LanguageCookieName,
                defaultValue: defaultCultureCode,
                defaultExpiration: DateTime.Now.AddYears(1),
                httpOnly: false // allow access via JavaScript
                );

            return(value);
        }
Example #2
0
        /// <summary>
        /// Get the selected country code
        /// </summary>
        /// <remarks>Defaults to country of the default market</remarks>
        /// <returns></returns>
        public static string GetSelectedCountryCode(HttpContextBase context, string countryCode = null)
        {
            // get market that matches country code (or default)
            var defaultMarket = GlobalUtilities.GetMarket(countryCode);
            // get the cookie (generates using default value if not available)
            var value = GlobalUtilities.GetCookie(
                context,
                cookieName: GlobalSettings.Globalization.CountryCookieName,
                defaultValue: defaultMarket.MainCountry,
                defaultExpiration: DateTime.Now.AddYears(1),
                httpOnly: false // allow access via JavaScript
                );

            // return the value
            return(value);
        }