Ghetto ASP.NET Debugging - Useful Extensions

        public static void Write(this System.Web.HttpResponse response, string formatString, params object[] args)
{
System.Web.HttpContext.Current.Response.Write(string.Format(formatString, args));
}

public static void WriteLine(this System.Web.HttpResponse response, string s)
{
System.Web.HttpContext.Current.Response.Write(s);
System.Web.HttpContext.Current.Response.Write("<br />");
}

public static void WriteLine(this System.Web.HttpResponse response, string formatString, params object[] args)
{
System.Web.HttpContext.Current.Response.WriteLine(string.Format(formatString, args));
}
Published Friday, April 11, 2008 11:22 AM by mxmissile
Filed under:

Comments

# re: Ghetto ASP.NET Debugging - Useful Extensions

Friday, April 11, 2008 2:42 PM by Jeff

Or you could write the stuff to Trace, where it belongs.

# re: Ghetto ASP.NET Debugging - Useful Extensions

Friday, April 11, 2008 2:47 PM by Jay

Jeff - Well, then it won't be ghetto anymore... :p

# re: Ghetto ASP.NET Debugging - Useful Extensions

Friday, April 11, 2008 2:50 PM by rajbk

Since your extension methods are for debugging, consider marking them with

[Conditional("DEBUG")]

so they don't get accidentally run in production.

msdn2.microsoft.com/.../aa664622(VS.71).aspx

Raj

# re: Ghetto ASP.NET Debugging - Useful Extensions

Monday, April 14, 2008 10:27 AM by mxmissile

You are correct Jeff, they should be in Trace.* or even Debug.*, however as Jay pointed out, this is strictly for ghetto debugging... ;-)  And thanx for the tip Raj!

Leave a Comment

(required) 
(required) 
(optional)
(required)