It is currently Mon Apr 23, 2018 11:24 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: 15743
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.

        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 1 guest

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.