internal static void GetLanguagePostFormParameters(RequestContext requestContext, HttpRequest request, out CultureInfo culture, out string timeZoneKeyName, out bool isOptimized, out string destination) { culture = null; timeZoneKeyName = string.Empty; isOptimized = false; destination = string.Empty; string text = request.Form["lcid"]; int num = -1; if (string.IsNullOrEmpty(text)) { throw new OwaInvalidRequestException("locale ID parameter is missing or empty"); } if (!int.TryParse(text, out num) || !ClientCultures.IsSupportedCulture(num)) { throw new OwaInvalidRequestException("locale ID parameter is invalid"); } culture = new CultureInfo(num); timeZoneKeyName = request.Form["tzid"]; if (string.IsNullOrEmpty(timeZoneKeyName)) { throw new OwaInvalidRequestException("timezone ID parameter is missing or empty"); } ExTimeZone exTimeZone = null; if (!ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(timeZoneKeyName, out exTimeZone)) { throw new OwaInvalidRequestException("timezone ID parameter is invalid"); } if (request.Form["opt"] != null) { isOptimized = true; } destination = HttpUtilities.GetFormParameter(requestContext.HttpContext.Request, "destination", false); }
internal static bool TryReadMowaGlobalizationSettings(RequestContext requestContext, out CultureInfo culture, out string timeZoneKeyName) { string text = requestContext.HttpContext.Request.QueryString["MOWALanguageID"]; string text2 = requestContext.HttpContext.Request.QueryString["MOWATimeZoneID"]; culture = null; timeZoneKeyName = null; if (string.IsNullOrEmpty(text)) { HttpCookie httpCookie = requestContext.HttpContext.Request.Cookies["MOWALanguageID"]; if (httpCookie != null) { text = httpCookie.Value; } } if (string.IsNullOrEmpty(text2)) { HttpCookie httpCookie2 = requestContext.HttpContext.Request.Cookies["MOWATimeZoneID"]; if (httpCookie2 != null) { text2 = httpCookie2.Value; } } if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2)) { return(false); } try { culture = new CultureInfo(text); if (!ClientCultures.IsSupportedCulture(culture)) { return(false); } } catch (CultureNotFoundException arg) { ExTraceGlobals.CoreCallTracer.TraceDebug <string, CultureNotFoundException>(0L, "The language passed in by MOWA is invalid, language={0}, exception: {1}", text, arg); return(false); } timeZoneKeyName = text2; return(!string.IsNullOrEmpty(timeZoneKeyName) && RequestDispatcherUtilities.IsValidTimeZoneKeyName(timeZoneKeyName)); }
internal static CultureInfo GetUserCultureFromEcpCookie(RequestContext requestContext, EcpUserSettings settingToReload) { CultureInfo cultureInfo = null; if (UserContextUtilities.IsFlagSet((int)settingToReload, 32)) { HttpCookie httpCookie = HttpContext.Current.Request.Cookies["mkt"]; if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value)) { CultureInfo cultureInfo2 = CultureInfo.GetCultureInfo(httpCookie.Value); if (ClientCultures.IsSupportedCulture(cultureInfo2)) { cultureInfo = cultureInfo2; } } if (cultureInfo == null) { ExTraceGlobals.UserContextCallTracer.TraceDebug(0L, "UserContext.ReloadUserSettings: The culture cookie doesn't have a valid value."); } } return(cultureInfo); }