How to create an array of form input posts in C#?

Hi, I would like to create an array that holds all of the form field's input in C#.  In php I would do something like this:

$required_fields = array();
			foreach($_POST as $key => $value){
			$required_fields[] = $key;
		}

Open in new window


I can't figure out what to do in C# though.  Anyone know how to go about this?
FairyBusinessAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Craig WagnerSoftware ArchitectCommented:
The simplest solution would be:
string[] values = new string[Request.Form.Count];
Request.Form.CopyTo( values, 0 );

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FairyBusinessAuthor Commented:
if my form as an id of id="signup" how would I call the form by name in your code?
0
Craig WagnerSoftware ArchitectCommented:
You don't call the form by name. You can only submit one form, so the Request.Form contains the posted data for whichever form was posted. Any other form on the page would not have any data posted.
0
FairyBusinessAuthor Commented:
thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.