Send data from one page to another

前端 未结 5 1224
面向向阳花
面向向阳花 2020-12-01 17:28

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:

         


        
5条回答
  •  [愿得一人]
    2020-12-01 17:49

    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 Sessions?

    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.

提交回复
热议问题