Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...POST requests not workingPOST requests not working
Previous
 
Next
New Post
4/21/2010 9:27 PM
 

 Kyle,

I use following in .ascx file to submit Form data ... not an ideal solution but works.

<input id="nameID" name="name" value="" type="text" size="30" maxlength="20" />

....

<input id="zipID" name="zip" value="" type="text" size="6" maxlength="5" onblur='validateZip();' /> 

<input id="submitID" type="submit" onclick=" validateFORM();if (formValid == 'true'){this.form.action='https://URL';this.form.submit();}"

In the footer of the module page, i have added following to change the encoding format of the form:

<script type="text/javascript">document.Form.enctype="application/x-www-form-urlencoded";</script>

My problem of not being able to parse POST data was because of the tool that i was using to construct the POST requests, but when i sent POST requests from a Web Browser, i was able to receive and parse the Form data with no problem.

BTW, i didn't need to make "EnableViewStateMac" false to receive POST data from other website ..... i think that change is needed only if Server.Transfer is used and someone wants to preserve the Form data while exchanging between various files on the server.

 
New Post
4/22/2010 9:37 AM
 

Here's some code where I "POST" to the gateway and the gateway responds with a value to indicate the transaction's status. 
No page is displayed on the gateway, it just returns a value.

Public Shared Function VerifiyPayment(ByVal TransactionID As String) As VerificationStatus
        Dim result As VerificationStatus = VerificationStatus.Unset

        Dim myRequest As HttpWebRequest = CType(HttpWebRequest.Create(GatewayParameters.VerificationURL), HttpWebRequest)
        myRequest.AllowAutoRedirect = False
        myRequest.Method = "POST"
        myRequest.ContentType = "application/x-www-form-urlencoded"

        Dim strToSend As String = String.Format("TransactionID={0}&ECOMRequestID={1}", TransactionID, GatewayParameters.ECOMRequestID)

        'Create post stream
        Dim RequestStream As Stream = myRequest.GetRequestStream()
        Dim SomeBytes() As Byte = Encoding.UTF8.GetBytes(strToSend)
        RequestStream.Write(SomeBytes, 0, SomeBytes.Length)
        RequestStream.Close()

        'Send request and get response
        Dim myResponse As HttpWebResponse = CType(myRequest.GetResponse(), HttpWebResponse)
        If myResponse.StatusCode = HttpStatusCode.OK Then
            'Obtain a 'Stream' object associated with the response object.
            Dim ReceiveStream As Stream = myResponse.GetResponseStream()
            Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")

            'Pipe the stream to a higher level stream reader with the required encoding format.
            Dim readStream As StreamReader = New StreamReader(ReceiveStream, encode)

            'Read result
            Dim Result As String = readStream.ReadLine()

            Select Case Result
                Case "0"
                    result = VerificationStatus.TransactionApproved
                Case "1"
                    result = VerificationStatus.TransactionDeclined
                Case "2"
                    result = VerificationStatus.TransactionNotFound
                Case "3"
                    result = VerificationStatus.SystemError
                Case Else
                    result = VerificationStatus.SystemError
            End Select

            'Close the response to free resources.
            myResponse.Close()   
        End If

End Function




After my customer enter's their payment info on the gateway's PCI Compliant page, it returns back to my site
with a "POST" (I think) and I have to read the parameters and process....

Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    Me.Page.EnableViewStateMac = False
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Try
        If Page.IsPostBack = False Then

            TransactionID = GetRequestParam("TransactionID")
            ResponseCode = GetRequestParam("ResponseCode")
            ResponseText = GetRequestParam("ResponseText")
            ApprovalCode = GetRequestParam("ApprovalCode")
            AVSResultCode = GetRequestParam("AVSResultCode")
            PurchaseIdentifier1 = GetRequestParam("PurchaseIdentifier1")
            PurchaseIdentifier2 = GetRequestParam("PurchaseIdentifier2")

            hfTransactionID.Value = TransactionID
           
            .... Save the transaction ...

            'display the transaction info...
            With paymentInfo
                lblAccountNumber.Text = .AccountID
                lblCustomerName.Text = .AccountName
                lblTransactionID.Text = .Id
                lblTransactionDate.Text = .TransactionDateTime
                lblTransactionAmount.Text = sy.DisplayMoney(.TransactionAmount) & "   * Includes Convenience Fee"
                lblStatus.Text = .TransactionStatus
                lblApprovalCode.Text = .ApprovalCode
                lblMessage.Text = .ResponseText
            End With

        End If
    Catch exc As Exception        'Module failed to load
        ProcessModuleLoadException(Me, exc)
    End Try
End Sub

Private Function GetRequestParam(ByVal parameter As String) As String
    Dim result As String = ""
    Try
        result = Request.Params(parameter)
    Catch ex As Exception
    End Try
    Return result
End Function

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...POST requests not workingPOST requests not working


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out