What is the equivalent of Console.WriteLine in ASP.net / C#.net code

kwh3856
kwh3856 used Ask the Experts™
on
I am trying to debug an application that is written in C#.net and ASP.net.  All code generates web pages.  I need to use the Console.WriteLine feature but I can not use this in ASP.net environment.  Is there some kind of equivilent command for asp.net

Here is the code I am trying to run but cannot get any output.
private static void PrintFields(Object pRecord)
        {
            // Print the header of the report
            Console.WriteLine("Length   Field Name");
            FieldInfo[] fInfos = pRecord.GetType().GetFields(BindingFlags.Public |
                                                             BindingFlags.NonPublic |
                                                             BindingFlags.Instance);
            // Iterate through all the fields and print the length of each string
            // or binary filed.
            foreach (FieldInfo fInfo in fInfos)
            {
                // String Fields
                if (fInfo.FieldType == typeof(string))
                {
                    // Get the value of the field
                    Object value = fInfo.GetValue(pRecord);
                    // If value has data print its field lentgth and name
                    if (value != null)
                    {
                        Console.WriteLine(String.Format("{0,-8} {1}",
                            value.ToString().Length, fInfo.Name));
                    }
                }
                // Binary Fields
                if (fInfo.FieldType == typeof(Binary))
                {
                    Binary value = (Binary)fInfo.GetValue(pRecord);
                    if (value != null)
                    {
                        Console.WriteLine(String.Format("{0,-8} {1}",
                            value.Length, fInfo.Name));
                    }
                }
            }
        }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
Commented:
Response.Write(yourString);
kwh3856Owner

Author

Commented:
Thank you very much
Top Expert 2013

Commented:
Although the question is closed... an FYI...to add a line break..
Response.Write(yourString + "<br \\>");
kwh3856Owner

Author

Commented:
guru sami,
Once again....Thank You.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial