locked
Form Post remained to same page. RRS feed

  • Question

  • User944339287 posted

    Hi guys. my website will post to this URL http://localhost:58315/post-testing/https://testsecureacceptance.cybersource.com/pay  when I trigger it at http://localhost:58315/post-testing/ ​

    How can i fix it? tqtq

    below is my code for posting value to specific URL (https://testsecureacceptance.cybersource.com/pay)

        Public Sub New()
    
            inputValues = New NameValueCollection()
            Url = "​https://testsecureacceptance.cybersource.com/pay"
            Method = "post"
            FormName = "ePayment"
    
        End Sub
    
        Public Sub Post()
            Dim context = HttpContext.Current
            context.Response.Clear()
            context.Response.Write("<html><head>")
            context.Response.Write(String.Format("</head><body onload=""document.{0}.submit()"">", FormName))
            context.Response.Write(String.Format("<form name=""{0}"" method=""{1}"" action=""{2}"" >", FormName, Method, Url))
            For i As Integer = 0 To inputValues.Keys.Count - 1
                context.Response.Write(String.Format("<input name=""{0}"" type=""hidden"" value=""{1}"">", HttpUtility.HtmlEncode(inputValues.Keys(i)), HttpUtility.HtmlEncode(inputValues(inputValues.Keys(i)))))
            Next
            context.Response.Write("</form>")
            context.Response.Write("</body></html>")
            context.Response.[End]()
        End Sub



    Thursday, September 12, 2019 5:52 AM

All replies

  • User-719153870 posted

    Hi kengkit,

    As far as i know, we don't post a form to a 3rd-party website with action in form because of the url error you have already met.

    Also it's little confusing why you want to post a form to a 3rd-party website.

    Maybe you can try the httpclient post in Aso.Net.

    Best Regard,

    Yang Shen

    Thursday, September 12, 2019 7:52 AM