response redirect which posts data to another url in asp net

response redirect which posts data to another url in asp net  using -',http-post,response.redirect,http-get'

I want to redirect a response to another URL while it contains some POST data in it's HTTP header.

// Inside an ASP.NET page code behind:
// This will sent data to via GET.
// I want to POST this data to instead.

How to do this in ASP.NET?

asked Sep 14, 2015 by JeroldMeyers
0 votes

3 Answers

0 votes

you can send huge data also with this trick..


StringBuilder sb = new StringBuilder();
sb.AppendFormat("", id);
// Other params go here


answered Sep 14, 2015 by BarHauslaib
0 votes

You can't POST using a redirect. By definition a redirect means the server sending a 302 redirect HTTP status code to the client with the new location so that the client issues a GET request to this new location. That's how the HTTP protocol works and there's not mu ch you can do about it.

So one way to achieve this would be to redirect to some temporary page that will contain an HTML with method="POST" and containing the values you want to send as hidden fields. Then you could use javascript to autosubmit this form.

answered Sep 14, 2015 by RodRobles
0 votes

Though it is quite old thread, I thought I would share how I do it.

Let's say sending page is a.aspx and destination page is b.aspx.

  1. Collect user inputs in a.aspx. User clicks submit button which causes postback.
  2. inside Button_click event of a.aspx, process volume data (for example save uploaded binary files). Determine link of the volume data and append that to end of request.form name-value string.
  3. Encrypt the final name-value string and set it to a cookie.
  4. Redirect to b.aspx
  5. in b.aspx, retrieve that cookie, decrypt and you get all name-value pair. Now process them as usual.

Advantages: (a) b.aspx is shown in browser address bar. It enters in browser's history. Server.transfer do these. (b) It gives effect of post. Users can not see the name-value pair in querystring.

answered Sep 14, 2015 by TanjaSkeyhil