Functionality Not Working When Secure Parameter Turn On

Thursday, June 20, 2024 3:25:20 AM
  • Posted: Wednesday, August 11, 2021 2:49 PM
  • 20
Hi All,

I am running into a weird issue when the  UseDefaultSecurityHeaders and CookieSecurePolicyAlways this set to true in appsettings.json. I am redirecting to the payment gateway to submit the form in PostProcessPayment method. Below is my code snippet


                formParams.Add("signature", strEncPOSTData);

                //var url = QueryHelpers.AddQueryString(_CashFreePaymentSettings.PayUri, queryParameters);
                StringBuilder s = new StringBuilder();
                s.Append("<html>");
                s.AppendFormat("<body onload='document.forms[\"form\"].submit()'>");
                s.AppendFormat("<form name='form' action='{0}' method='post'>", _PaymentSettings.PayUri);

                foreach (var key in formParams)
                {
                    s.AppendFormat("<input type='hidden' name='{0}' value='{1}' />", key.Key, key.Value);
                }
                s.Append("</form></body></html>");


                return
                     _httpContextAccessor.HttpContext.Response.Body.WriteAsync(Encoding.ASCII.GetBytes(s.ToString())).AsTask();
Harshal
0
back to top
Filters