2004-06-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 2 Jun 2004 14:47:02 +0000 (14:47 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 2 Jun 2004 14:47:02 +0000 (14:47 -0000)
* TraceData.cs: html-encode the messages written to the trace. Fixes
bug #59431.

svn path=/trunk/mcs/; revision=28701

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/TraceData.cs

index 73829845960cb3108a67df4b0c84322092f77ff7..0c7819f621056d799c94b6ecb5f916518b0a41d2 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TraceData.cs: html-encode the messages written to the trace. Fixes
+       bug #59431.
+
 2004-06-01  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * HttpWorkerRequest.cs: the hashtables are now case-insensitive. Thanks
index 66b7992c3edd9095ab75459742df754c8be37c1b..f9e9e21601c1bae65c6d1a9eac65e9487b9ab77d 100644 (file)
@@ -114,7 +114,7 @@ namespace System.Web {
 
                        DataRow r = info.NewRow ();
                        r ["Category"] = category;
-                       r ["Message"] = msg;
+                       r ["Message"] = HtmlEncode (msg);
                        r ["Exception"] = (error != null ? error.ToString () : null);
                        r ["TimeSinceFirst"] = time;
                        r ["IsWarning"] = Warning;
@@ -122,6 +122,16 @@ namespace System.Web {
                        info.Rows.Add (r);
                }
 
+               static string HtmlEncode (string s)
+               {
+                       if (s == null)
+                               return s;
+
+                       string res = HttpUtility.HtmlEncode (s);
+                       res = res.Replace ("\r\n", "<br />");
+                       return res.Replace (" ", "&nbsp;");
+               }
+               
                public void AddControlTree (Page page)
                {
                        AddControl (page, 0);