I am trying to send form data from one page to another using C# ASP.Net. I have two pages default.aspx and default2.aspx.Here is the code I have in default.aspx:
While all the answers here will work some aren't the most efficient. Why would a simple/standard http POST
have to invoke (expensive) server-side Session
s?
Your code isn't doing anything special - it is simply POSTing a form to another page. All you need to do to obtain the POSTed data is go through the Request.Form
collection.
Prior to the availability to set the PostBackUrl
(if memory serves version 1 of asp.net), Server.Transfer
and getting references to the previous page was how cross-page POSTing was done/documented. However, with PostBackUrl
, things go back to basics, the way it should be - a standard http POST
from one resource to another.
Here's a similar SO thread that maybe helpful.