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
If your objective is to be able to access the parameters being passed in regardless of the method used (get vs. post) then you can just use Request.Params["paramname"] to access them, and you don't need to worry about whether it was a get or a post.
Pardon me if I am not quite understanding the question but I believe you are asking for the QueryString property?
http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx
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.
Try
string foobar = Request.QueryString["foo"];
Basically that is:
var request = Request["q"]; // $_REQUEST
var post = Request.Form["q"]; // $_POST
var get = Request.QueryString["q"]; // $_GET
If you are looking to get the query string value of Foo use:
Request.QueryString["foo"];
You can use the request object to get values posted to your page.