Simple way to make a string out of Request.Form

  • Thread starter Thread starter crossoft
  • Start date Start date
C

crossoft

Is there a quick way to get all the params and values from the
Request.Form object in ASP.NET?

"If Only it were this simple" Code:
Dim s As String = Request.Form.ToString()

Then s would for example become

id=3&name=Joe+Smith&view=32&page=1&count=1502

Anyone know how to do that? Thanks.
 
Dim loop1 As Integer
Dim arr1() As String
Dim coll As NameValueCollection

' Load Form variables into NameValueCollection variable.
coll=Request.Form

' Get names of all forms into a string array.
arr1 = coll.AllKeys
For loop1 = 0 To arr1.GetUpperBound(0)
Response.Write("Form: " & arr1(loop1) & "<br>")
Next loop1



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
=====================
 
Thanks Juan,

I guess it was wishful thinking on my part that there was some
undocumented method of the Form class that dumped it all out. Your
code is almost verbatim what I've been having to do.

If only we could inherit from the Form class to add our own
capabilities!

Your fellow Wrox Author - Christopher L. Miller
 
Hey, Chris!
Long time no hear from you!

re:
code is almost verbatim what I've been having to do.

Yup...it's just about the only way to get at that.

re:
If only we could inherit from the Form class
to add our own capabilities!

That'd be nice...

re:
Your fellow Wrox Author

We had the best of times with the "old" Wrox, didn't we ?

:-)



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
=====================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top