[Mono-bugs] [Bug 60739][Blo] Changed - ASP.NET Trace pageOutput and localOnly Bug(s)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 29 Jun 2004 12:23:21 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by davidandrewtaylor@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=60739

--- shadow/60739	2004-06-29 09:40:01.000000000 -0400
+++ shadow/60739.tmp.3194	2004-06-29 12:23:21.000000000 -0400
@@ -152,6 +152,73 @@
 * Trace.axd should NEVER be viewable if Tracing is disabled in 
 Web.config (and it is disabled by default in machine.config)
 
 
 ------- Additional Comments From gonzalo@ximian.com  2004-06-29 09:40 -------
 The fix for this will be in CVS after 1.0 is released.
+
+------- Additional Comments From davidandrewtaylor@hotmail.com  2004-06-29 12:23 -------
+Here are the requires patches:
+
+Part A) Your patch to PageParser.cs was correct!
+
+Part B) Change to TraceHandler.cs
+In TraceHandler.cs at the start of the ProcessRequest method we need 
+to make sure we do not show the trace if it has been disabled.
+Change this line:
+if (manager.LocalOnly && !context.Request.IsLocal) { To this line:
+if (!manager.Enabled || manager.LocalOnly && !
+context.Request.IsLocal) {
+
+Part C) TraceContext.cs
+I am basing this change on RC1, assuming your patch is not applied.  
+We need to add a new property to track if a Trace attribute exists 
+at the ASPX Page level.
+      
+      private bool _haveTrace = false; // Added
+                                       // Added
+      internal bool HaveTrace {        // Added
+          get {                        // Added
+              return _haveTrace;       // Added
+          }                            // Added
+      }                                // Added
+
+      // This next part is the same of RC1 except for the 
+_haveTrace=true
+      // in the setter  
+
+      public bool IsEnabled {
+	 get { 
+		return _Enabled; 
+	 } 
+
+	 set {                         
+		 if (value && data == null)
+			 data = new TraceData ();
+	     _haveTrace = true;                // Added
+	    _Enabled = value;
+	 }
+      }
+
+Part D) Change to Page.cs
+We need to rewrite the RenderTrace method in Page.cs as:
+
+        private void RenderTrace (HtmlTextWriter output)
+        {
+            TraceManager traceManager = HttpRuntime.TraceManager;
+
+            if (Trace.HaveTrace && !Trace.IsEnabled
+                || !Trace.HaveTrace && !traceManager.Enabled)
+                   return;
+		
+            Trace.SaveData ();
+
+            if (!Trace.HaveTrace && traceManager.Enabled &&
+                !traceManager.PageOutput) 
+                    return;
+
+            if (!traceManager.LocalOnly || Context.Request.IsLocal)
+                Trace.Render (output);
+	}
+
+
+