It is currently Sun Dec 17, 2017 2:18 am



Reply to topic  [ 1 post ] 
C# dump all posted variables 
Author Message
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 15728
Location: On a slope
Reply with quote
Post 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.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Wed May 14, 2008 12:23 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.