protected virtual void Page_Load(object sender, EventArgs e) { var cookieManager = new RequestCookieManager(Request.Cookies); string authenticationId = cookieManager.GetAuthenticationId(); string sessionId = cookieManager.GetSessionId(); var loginService = new LoginService(); if (!string.IsNullOrEmpty(authenticationId)) { LoginResponse response = loginService.Validate(sessionId, authenticationId); if (response == null || !response.IsSuccess) Response.Redirect("~/Login.aspx" + "?redirect=" + Request.RawUrl); } else { Response.Redirect("~/Login.aspx" + "?redirect=" + Request.RawUrl); } if (Configuration.SSLEnabled) { if (!Request.IsLocal && !Request.IsSecureConnection) { string redirectUrl = Request.Url.ToString().Replace("http:", "https:"); Response.Redirect(redirectUrl); } } }
protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); string postData = PostData; var cookieManager = new RequestCookieManager(Request.Cookies); var billingAddress = cookieManager.GetBillingAddress(); var sessionId = cookieManager.GetSessionId(); var authenticationId = cookieManager.GetAuthenticationId(); if (string.IsNullOrEmpty(authenticationId) || string.IsNullOrEmpty(sessionId) || billingAddress == null) { RedirectToPreviousPage(); } else { var isOfflineBooking = cookieManager.IsOfflineBooking; var voucherCode = cookieManager.GetVoucherCode(); if (isOfflineBooking) { var token = cookieManager.GetToken(); if (token == null) { RedirectToPreviousPage(); } else { var isOfflineDataSet = SetOfflineParametersInSession(sessionId, authenticationId, token, voucherCode); if (isOfflineDataSet == false) { RedirectToPreviousPage(); } } } var paymentService = new PaymentService(); postData = paymentService.GetPostData(authenticationId, sessionId, billingAddress); } Response.Clear(); Response.Write(postData); Response.End(); }
protected virtual void Page_Load(object sender, EventArgs e) { var cookieManager = new RequestCookieManager(Request.Cookies); string authenticationId = cookieManager.GetAuthenticationId(); string sessionId = cookieManager.GetSessionId(); var loginService = new LoginService(); if (string.IsNullOrEmpty(authenticationId) == false) { var pageName = Path.GetFileNameWithoutExtension(Request.PhysicalPath); var isAuthorized = loginService.IsAuthorized(sessionId, authenticationId, pageName); if (isAuthorized == false) { Response.Redirect("~/Admin/AdminLogin.aspx"); } } else { Response.Redirect("~/Admin/AdminLogin.aspx"); } }
protected override void Page_Load(object sender, EventArgs e) { try { var header = Request.Headers.ToString(); Logger.LogMessage(new Log("Headers", header, "PaymentResponse.aspx")); Logger.LogMessage(new Log("FormData", Request.Form.ToString(), "PaymentResponse.aspx")); Logger.LogMessage(new Log("QueryString", Request.QueryString.ToString(), "PaymentResponse.aspx")); } catch (Exception) { } base.Page_Load(sender, e); string response = Request.QueryString["DR"]; var provider = "EBS"; var variables = Request.QueryString; if (string.IsNullOrEmpty(response)) { //Check PayU response = Request.Form["hash"]; provider = "PayU"; variables = Request.Form; } var cookieManager = new RequestCookieManager(Request.Cookies); var sessionId = cookieManager.GetSessionId(); var authenticationId = cookieManager.GetAuthenticationId(); var isOfflineBooking = cookieManager.IsOfflineBooking; var voucherCode = cookieManager.GetVoucherCode(); if (!string.IsNullOrEmpty(response) && !string.IsNullOrEmpty(sessionId)) { var paymentService = new PaymentService(); string errorMessage; if (!paymentService.ValidateResponse(response, provider, authenticationId, sessionId, variables, voucherCode, out errorMessage)) { Response.Write(errorMessage); Response.End(); } else { if (isOfflineBooking == false) { var travelService = new TravelService(); BookResponse bookResponse = travelService.Book(sessionId, authenticationId); if (bookResponse != null && bookResponse.IsSuccess) { HttpContext.Current.Response.Redirect("Confirm.aspx"); } else { string error = bookResponse == null ? string.Empty : "Error: " + bookResponse.ErrorMessage; HttpContext.Current.Response.Redirect("BookingFailed.aspx?error=" + error); } } else { HttpContext.Current.Response.Redirect("OfflinePaymentConfirm.aspx"); } } } else { Response.Write("Sorry, invalid response received. Please login again and restart."); Response.End(); } }