How to handle C# .NET GET / POST?

前端 未结 6 1545
走了就别回头了
走了就别回头了 2020-12-29 05:23

As I\'m new to .NET after coming from PHP I chose C# to work with and its coming along nicely. I have a question though regarding the handling of GET and POST.

So fa

6条回答
  •  天涯浪人
    2020-12-29 05:42

    The .Net version of $_GET[] is :

     Request.QueryString["parameter1"]
    

    You do not require to do this IF condition.

    The .Net version of $_POST[] is :

     Request.Form["paramName"];
    

    Still no need the IF condition.

    BUT in Asp.Net webform you do not require to use all the time Request class because the PostBack to the page will contain your form data directly into the control value. Let say you have a textbox called txt1, when the user will submit the form you can get the value of this textbox directly by accessing txt1.

提交回复
热议问题