ClanKiller.com
http://forums.clankiller.com/

C# dump all posted variables
http://forums.clankiller.com/viewtopic.php?f=24&t=2828
Page 1 of 1

Author:  Satis [ Wed May 14, 2008 12:23 pm ]
Post subject:  C# dump all posted variables

So, anyone that does a lot of work in PHP may be familiar with print_r($_POST) which will spit out all your POSTed vars. Very handy when you're trying to debug why a POSTed form isn't working as expected.

I didn't know of something similar in c# but today managed to figure it out.

Code:
        System.Collections.Specialized.NameValueCollection POST = Request.Form;
        for (int i = 0; i < POST.Count; i++)
        {
            Response.Write(POST.GetKey(i) + "::" + POST.Get(i) + "<br>");
        }


That's actually amazingly obvious and simple now that I've figured it out, but it may save someone else some time and frustration.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/