Exemplo n.º 1
0
        public virtual ActionResult ProcessRequest()
        {
            if (AtPreviewMode() && InvalidCrossSiteAuth())
            {
                return(new HttpUnauthorizedResult());
            }

            // check with repository for redirection mappings
            if (_httponContextBase.Request.Url != null)
            {
                var redirUrl = _cmsEngine.RedirectionLookup(_httponContextBase.Request.Url);
                if (!string.IsNullOrEmpty(redirUrl))
                {
                    return(new RedirectResult(string.Format("/{0}/{1}", _cultureUtility.GetCultureCode(), redirUrl)));
                }
            }

            CmsEngine.Response response;

            //try
            //{
#if (DEBUG)
            response = this.ProcessFakeRequest(_httponContextBase.Request.Url,
                                               new MvcRequestContext(ControllerContext, ViewData, TempData));
#else
            response = _cmsEngine.ProcessRequest(_httponContextBase.Request.Url,
                                                 new MvcRequestContext(ControllerContext, ViewData, TempData));
#endif
            //}
            //catch (Exception ex)
            //{
            //    Log.Error("Internal CMS error.", ex);
            //    throw ex;
            //    return
            //        new FilePathResult(
            //            string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.InternalServerError,
            //                _cultureUtility.GetCultureCode()), MediaTypeNames.Text.Html);
            //}

            switch (response.Type)
            {
            case CmsEngine.ResponseType.OK:
                return(Content(response.Body));

            case CmsEngine.ResponseType.PageNotFound:
                return
                    (new FilePathResult(
                         string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.NotFound,
                                       _cultureUtility.GetCultureCode()), MediaTypeNames.Text.Html));

            default:
                return
                    (new FilePathResult(
                         string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.InternalServerError,
                                       _cultureUtility.GetCultureCode()), MediaTypeNames.Text.Html));
            }
        }
Exemplo n.º 2
0
        public ActionResult ProccessRequest(string url)
        {
            try
            {
                return(View(String.Format("~/Views/{0}.cshtml", "index")));
            }
            catch (Exception ex)
            {
                HttpException httpException = ex as HttpException;

                switch (httpException.GetHttpCode())
                {
                case 403:
                    return(View(string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.Forbidden,
                                              _cultureUtility.GetCultureCode())));

                case 404:
                    return(View(string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.NotFound,
                                              _cultureUtility.GetCultureCode())));

                default:
                    return(View(string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.InternalServerError,
                                              _cultureUtility.GetCultureCode())));
                }
            }
        }
Exemplo n.º 3
0
        private void DisplayErrorPage(HttpContextBase httpContext, Configurations configurations,
                                      CultureUtility cultureUtility, HttpStatusCode fileHttpStatusCode, HttpStatusCode headerHttpStatusCode)
        {
            string errorPagePath = string.Format(configurations.ErrorPagePath, (int)fileHttpStatusCode,
                                                 cultureUtility.GetCultureCode());

            if (!File.Exists(Server.MapPath(errorPagePath)))
            {
                errorPagePath = string.Format(configurations.ErrorPagePath, (int)HttpStatusCode.NotFound,
                                              DefaultCultureCode);
            }

            Log.InfoFormat("Displaying {0}.", errorPagePath);

            httpContext.Response.StatusCode  = (int)headerHttpStatusCode;
            httpContext.Response.ContentType = MediaTypeNames.Text.Html;
            httpContext.Response.WriteFile(errorPagePath);
            httpContext.Response.End();
        }
Exemplo n.º 4
0
        public ActionResult WorldPay3DSecureCallback(string paRes, string md)
        {
            var mobile = RouteData.Values["mobile"];

            var depositUrl = GetDepositUrl(mobile);

            var casinoUrl = GetCasinoUrl(mobile);

            try
            {
                Log.InfoFormat("Getting PaRes [{0}] and MD [{1}] from [{2}]", paRes, md,
                               _networkUtility.GetClientIPAddress());


                var result = _paymentApiProxy.ConfirmDepositByWorldPay(_cultureUtility.GetCultureCode(),
                                                                       _userContext.UserId,
                                                                       new PaymentDto.WorldPay.Confirmation
                {
                    PaymentAuthenticationResponse = paRes,
                    TransactionId = md,
                    CasinoUrl     = casinoUrl,
                    DepositUrl    = depositUrl
                });

                return
                    (View(GetViewPath(mobile), result));
            }
            catch (DepositNotCompletedException ex)
            {
                Log.Error("Failed to process WorldPay 3DS callback", ex);
                return
                    (View(GetViewPath(mobile), null));
            }
            catch (Exception ex)
            {
                Log.Error("Failed to process WorldPay 3DS callback", ex);
                //return new FilePathResult(
                //    string.Format(_configurations.ErrorPagePath, (int)HttpStatusCode.InternalServerError,
                //        _cultureUtility.GetCultureCode()), MediaTypeNames.Text.Html);

                return
                    (View(GetViewPath(mobile), null));
            }
        }