Redirect & Post to non ASP.Net page

Results 1 to 2 of 2

Thread: Redirect & Post to non ASP.Net page

  1. #1
    Join Date
    Dec 1969

    Default Redirect & Post to non ASP.Net page

    This seems to be a fairly tough question in the world of .Net since I can&#039;t seem to find the answer anywhere, but maybe there is a chance someone here has tried this. I am using a ASP.Net form to process and validate user input information for a product order on a customized order system. I then want to send basic information to a payonly system to process the billing portion of the order. I need to pass a few basic values and redirect to a payment interface that usually accepts a post command with hidden values from a HTML form. The values are:<BR> <BR>txnmode = test<BR>mode = payonly<BR>storename = 830964<BR>chargetotal = 15.99 (or whatever the total for the order is)<BR> <BR>Because ASP.Net forms are runat the server a normal post event will not work. The page will just post back to itself. The closest I have been able to come to a solution is shown in my code below.<BR> <BR>********************************<BR>Private Sub cmdCheckout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCheckout.Click<BR> If Page.IsValid Then<BR> Dim URLString As String<BR> Dim postValues As String<BR> Dim byteArray As Byte()<BR> Dim myWebClient As New System.Net.WebClient()<BR> Dim sendArray As Byte()<BR><BR> URLString = ""<BR> postValues = "txnmode=test&mode=payonly&storename=830964&charge total=" & txtTotal.Text<BR> myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")<BR> byteArray = System.Text.Encoding.ASCII.GetBytes(postValues)<BR > sendArray = myWebClient.UploadData(URLString, "POST", byteArray)<BR> End If<BR>End Sub<BR>********************************<BR><BR>The code does not give me errors. It just posts back to itself like nothing happened. I need the page to redirect to the URLString and post the postValues to the new page. Any Ideas?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Redirect & Post to non ASP.Net page

    i believe that you are not absolutely correct.<BR><BR>the only time that forms are posted back automatically is when you include runat=server. have you tried leaving this property/value pair out?<BR><BR>be mindful though that you may lose your session information if you post to a non-aspx page, or to a page that is on a different server...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts