2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 6 Oct 2004 05:46:02 +0000 (05:46 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 6 Oct 2004 05:46:02 +0000 (05:46 -0000)
* TraceHandler.cs: error code is 403 and the message different when
trace is enabled but not for remote clients.

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

mcs/class/System.Web/System.Web.Handlers/ChangeLog
mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs

index 50459bd902401624413ba99908bb3a10a607793c..4f3e185e22032e9feb7861d7a20bc077cac2e38b 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * TraceHandler.cs: error code is 403 and the message different when
+       trace is enabled but not for remote clients.
+
 2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * TraceHandler.cs: check that trace is enabled or throw.
index 343aa5957a76362bafb8f83a57ea05bf6ec22d3e..23e35288f80454f58da4a4e07f96147cc22946cd 100644 (file)
@@ -44,11 +44,21 @@ namespace System.Web.Handlers
 #endif
        class TraceNotAvailableException : HttpException
        {
-               public TraceNotAvailableException () :
-                       base ("Trace Error") {}
+               bool notLocal;
+
+               public TraceNotAvailableException (bool notLocal) :
+                       base (notLocal ? 403 : 500, "Trace Error")
+               {
+                       this.notLocal = notLocal;
+               }
 
                internal override string Description {
-                       get { return "Trace.axd is not enabled in the configuration file for this application."; }
+                       get {
+                               if (notLocal)
+                                       return "Trace is not enabled for remote clients.";
+
+                               return "Trace.axd is not enabled in the configuration file for this application.";
+                       }
                }
        }
 
@@ -58,9 +68,8 @@ namespace System.Web.Handlers
                {
                        TraceManager manager = HttpRuntime.TraceManager;
 
-                       if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal) {
-                               throw new TraceNotAvailableException ();
-                       }
+                       if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal)
+                               throw new TraceNotAvailableException (manager.Enabled);
                                
                        HtmlTextWriter output = new HtmlTextWriter (context.Response.Output);