C#: How can I POST data to a page redirected by an earlier POST?

155 Views Asked by At

I am using c# to accomplish the following:

  1. Post data to a page (using HttpWebRequest).
  2. Get the response (redirected to another page by the posted data).
  3. Post the further data to the response page.

I am able to accomplish the first 2 steps, but I cannot get the 3rd step to work because it always takes me back to the beginning page. I have tried using a CookieCollection and transferring the cookies from the first request to the second, but it did not solve the problem. Any ideas on how to make it work?

Thank you very much in advance!

1

There are 1 best solutions below

0
On

You can try with PostBackUrl

<asp:button id="Button2"
      text="Post value to another page" 
      postbackurl="PostBackUrlPage.aspx" 
      runat="Server">
</asp:button>