public ActionResult Preview(string theme, int?storeId, string returnUrl) { // Initializes the preview mode if (!storeId.HasValue) { storeId = _services.StoreContext.CurrentStore.Id; } if (theme.IsEmpty()) { theme = _settingService.LoadSetting <ThemeSettings>(storeId.Value).DefaultDesktopTheme; } if (!_themeRegistry.ThemeManifestExists(theme) || _themeRegistry.GetThemeManifest(theme).MobileTheme) { return(HttpNotFound()); } using (HttpContext.PreviewModeCookie()) { _themeContext.SetPreviewTheme(theme); _services.StoreContext.SetPreviewStore(storeId); } if (returnUrl.IsEmpty() && Request.UrlReferrer != null && Request.UrlReferrer.ToString().Length > 0) { returnUrl = Request.UrlReferrer.ToString(); } TempData["PreviewModeReturnUrl"] = returnUrl; return(RedirectToAction("Index", "Home", new { area = (string)null })); }