C# noob question reading forms

admin

Administrator
Staff member
Ok i stick mainly to programming in php but a new assigment has stuck me with writing an application using c# and .net. So my simple question is when a form is submitted how do i read the data. Need to know how to read both post and get.

thxUse the Request.Params collection. All variables are there.
If you want just the POST, then you must use Request.Forms and the GET is in Request.QueryString.Everything you ever wanted to know about the .Net Request Object:

<!-- m --><a class="postlink" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebHttpRequestClassTopic.asp">http://msdn.microsoft.com/library/defau ... sTopic.asp</a><!-- m -->

Of particular interest will be the methods

Request.Form.Get - for POST returns a comma-separated string
Request.Form.GetValues - returns an array of strings
Request.QueryString.Get - same stuff but for GET
Request.QueryString.GetValues
 
Top