Whats the alternate solution of HttpContext.Current.Response in Dot Net Core 3.1?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 года назад
Below code work fine in .Net, now I upgrade my website to dot Net Core 3.1  "HttpContext.Current.Response not supporting in  Net Core 3.1"  

Whats the alternate solution in Dot Net Core 3.1 ?

Please gives the solution with sample code.

Thanks





     string checksum2 = Generate_MerchantRequest_Check_SumNetConnect(secretKey, merchantId, orderNo, amount, date, time);
    
    
                StringBuilder sb = new StringBuilder();
    
                sb.AppendLine("<html>");
                sb.AppendLine(String.Format("<body onload='document.forms[\"{0}\"].submit()'>", "Form1"));
                sb.AppendLine(String.Format("<form id='{0}' method='POST' action='{1}'>", "www.smmotors.org Form", urlNetConnect));
                sb.AppendLine("<input type='hidden' name='MERCHANT_ID' value='" + merchantId + "' />");
                sb.AppendLine("<input type='hidden' name='Order_No' value='" + orderNo + "' />");
                sb.AppendLine("<input type='hidden' name='Order_Amount' value='" + amount + "' />");
                sb.AppendLine("<input type='hidden' name='Date' value='" + date + "' />");
                sb.AppendLine("<input type='hidden' name='Time' value='" + time + "' />");
                sb.AppendLine("<input type='hidden' name='CheckSum' value='" + checksum2 + "' />");
                sb.AppendLine("<input type='hidden' name='Transaction_Desc' value='" + transactionDesc + "' />");
                sb.AppendLine("</form></body></html>");
            
                
                try
                {
                     HttpContext.Current.Response.Clear();
                     HttpContext.Current.Response.Write(sb.ToString());
                     HttpContext.Current.Response.End();
                     _webHelper.IsPostBeingDone = true;
        
                }
                catch (Exception ep)
                {
                    throw new Exception(ep.Message);
                }
3 года назад
There is a HttpContext.Response.WriteAsync but I dont know if it does the same thing

So are you are trying to POST a form to third party payment gateway - which one ?
If so maybe check if they have a later version of their SDK to show the new way to do it
There is this class Source43\Presentation\Nop.Web.Framework\RemotePost.cs
I also saw this post
https://stackoverflow.com/questions/53194200/how-httpcontext-response-end-in-asp-net-core

Otherwise what are you trying to do ?
3 года назад
I already try HttpContext.Response.WriteAsync its not work.

So are you are trying to POST a form to third party payment gateway - which one ?
Yes , KEENU(NetConnect)

There is this class Source43\Presentation\Nop.Web.Framework\RemotePost.cs
i see RemotePost.cs  but not work
3 года назад
Do they have a SDK ?
Is there a website which shows what / how to send ?
3 года назад
Sending Request
On NetConnect secure URL using the POST method parameters will be passed. Before sending the parameters merchant need to call the function Generate_CheckSum to generate the transaction verification code that will be used by NetConnect system to ensure that the data send by Merchant is not tampered.

Receiving Response of Request
Redirected URL will be provided by Merchant at the time of registration. On this URL transaction processing response will be send. Response send will be in the POST method and will correspond to the fields that were used for sending Request with additional elements.
On receiving the response from NetConnect first using the function Verify_CheckSum, validation of message will be performed against the received parameters. Please refer to “Appendix C: Sample code for receiving response from NetConnect” for details.


Sample Code
// Checksum Should be generated from code.
Checksum= new ClassName().Generate_MerchantRequest_Check_Sum(Secret_Key,Merchant_Id, Order_No, TotalOrderAmount, Date, Time);
<html>
<head>
<body>
<form
name="Redirect_to_NetConnect" method="post" action= "Insert URL provided by KEENU" > <input type="hidden" name="Merchant_ID" value="Merchant_ID" />
<input type="hidden" name="Order_No" value="Order_No" />
<input type="hidden" name="Order_Amount" value="Order_Amount" /> <input type="hidden" name="Date" value=”Date”/>
<input type="hidden" name="Time" value=”Time” />
<input type="hidden" name="CheckSum" value=”Checksum” />
<input type="hidden" name="Transaction_Desc" value="Order_Desc" />
</form>
</body>
</head>
</html>
Page
2 года назад
Can I add external JavaScript library "paymaen gateway library" in the form and use data from it ?

Thank you
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.