ASP.NET exposes the entire Request.Form contents as a
NameValueCollection. This collection is fully iterable and any new
fields will also be included in each Request. Just access the
NameValueCollection and iterate through it. For instance,

---
using System.Collections.Specialized;
...

NameValueCollection nvc = Request.Form;
for(int i = 0; i < nvc.Count; i++)
{
  Response.Write("Form field with name {0} contains value: {1}.",
nvc.GetKey(i), nvc[i]);
}

---

For another example, see the MSDN page: <http://msdn.microsoft.com/en-
us/library/system.web.httprequest.form(VS.80,loband).aspx>

On May 1, 7:19 pm, zachms <[email protected]> wrote:
> I am working on a form for my website and need some help. I currently
> have an aspx page that has a form on it. I want to capture the data
> that the user inputs in the form fields and first write the
> information to a database and then second I want to send the data in
> an email.
>
> Currently I have a simple asp page processing the form into an email.
> I am constructing the body using a bunch of lines of code using the
> request.form(fieldname) format. It works but I am interested in
> possibly using array to do this in case we decide to add fields. I
> think using the array will make it less maintenance if we add or
> change fields in the future.
>
> I am trying to get back into ASP.net coding as I haven't messed with
> it in about 4 years and am very rough. Any help and direction is
> appreciated.
>
> Thanks,
>
> Zach

Reply via email to