Response.Redirect with POST instead of Get?

后端 未结 14 941
离开以前
离开以前 2020-11-22 04:04

We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to \"submit\" a form with POST, n

14条回答
  •  清酒与你
    2020-11-22 04:35

    Here's what I'd do :

    Put the data in a standard form (with no runat="server" attribute) and set the action of the form to post to the target off-site page. Before submitting I would submit the data to my server using an XmlHttpRequest and analyze the response. If the response means you should go ahead with the offsite POSTing then I (the JavaScript) would proceed with the post otherwise I would redirect to a page on my site

提交回复
热议问题