Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Submitting a form in ASP.NET from ServerSide

Submitting a form in ASP.NET from ServerSide

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomdesignsysadmin
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    triton630
    wrote on last edited by
    #1

    I have a submit button on a page called orderconfirm.aspx. When I click that button I am trying to send an e-mail and then redirect to paypal's payment form. There are some hidden objects on the the page that contain the data that paypal needs to complete the transaction. But when I view source in the page, the form's action is posting back to itself:

    The serverside function is private void submit_Click(object sender, System.Web.UI.ImageClickEventArgs e) { SendEMail(); Response.Redirect("https://www.paypal.com/cgi-bin/webscr"); } Obviously this doesn't help me because I'm not actually posting the data, i'm just switching pages. Is there any way to change the action on the form from the server-side and/or submit the form from the server-side after I send the e-mail. Or maybe I should be taking a different approach...send the e-mail from the client-side? Help please.

    S G 2 Replies Last reply
    0
    • T triton630

      I have a submit button on a page called orderconfirm.aspx. When I click that button I am trying to send an e-mail and then redirect to paypal's payment form. There are some hidden objects on the the page that contain the data that paypal needs to complete the transaction. But when I view source in the page, the form's action is posting back to itself:

      The serverside function is private void submit_Click(object sender, System.Web.UI.ImageClickEventArgs e) { SendEMail(); Response.Redirect("https://www.paypal.com/cgi-bin/webscr"); } Obviously this doesn't help me because I'm not actually posting the data, i'm just switching pages. Is there any way to change the action on the form from the server-side and/or submit the form from the server-side after I send the e-mail. Or maybe I should be taking a different approach...send the e-mail from the client-side? Help please.

      S Offline
      S Offline
      sivilian
      wrote on last edited by
      #2

      A popular way to do it in ASP.NET is to use Server.Transfer. This will transfer the execution of the page to the URL specified. It has the same effect of posting or submitting the form to that page, as with the action attribute on the form. One thing you should be careful of though, is to not put anything in the output stream, like Response.Write, before your call to Server.Transfer, because this output will be output in the new page. hope this helps, sivilian

      T 1 Reply Last reply
      0
      • S sivilian

        A popular way to do it in ASP.NET is to use Server.Transfer. This will transfer the execution of the page to the URL specified. It has the same effect of posting or submitting the form to that page, as with the action attribute on the form. One thing you should be careful of though, is to not put anything in the output stream, like Response.Write, before your call to Server.Transfer, because this output will be output in the new page. hope this helps, sivilian

        T Offline
        T Offline
        triton630
        wrote on last edited by
        #3

        Thanks for the suggestion, but server.transfer will only submit to other .aspx pages. I'll have to try something else. Anyone else have any ideas?

        M 1 Reply Last reply
        0
        • T triton630

          Thanks for the suggestion, but server.transfer will only submit to other .aspx pages. I'll have to try something else. Anyone else have any ideas?

          M Offline
          M Offline
          Member 12203252
          wrote on last edited by
          #4

          Server.Transfer will work in this scenario. server.transfer("URL",boolean) I am not sure about the boolean value to be 'true' or 'false' to send the values to the redirecting page. check for appropriate option. or This is lengthy approach. feel really very long then ignore. create a aspx page and take all the values sent from the redirected page and build tags in the same manner how paypal needs and page onload write a javascript function to submit the form to paypal. make sure the form tag in the new page is not runat server. ... any doubt plz let me know....

          1 Reply Last reply
          0
          • T triton630

            I have a submit button on a page called orderconfirm.aspx. When I click that button I am trying to send an e-mail and then redirect to paypal's payment form. There are some hidden objects on the the page that contain the data that paypal needs to complete the transaction. But when I view source in the page, the form's action is posting back to itself:

            The serverside function is private void submit_Click(object sender, System.Web.UI.ImageClickEventArgs e) { SendEMail(); Response.Redirect("https://www.paypal.com/cgi-bin/webscr"); } Obviously this doesn't help me because I'm not actually posting the data, i'm just switching pages. Is there any way to change the action on the form from the server-side and/or submit the form from the server-side after I send the e-mail. Or maybe I should be taking a different approach...send the e-mail from the client-side? Help please.

            G Offline
            G Offline
            GISnet
            wrote on last edited by
            #5

            If you're trying to bypass paypal's confirm button, you're out of luck. http://www.knowledgegeek.com - Come on! I need the Traffic!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups