2002-04-11 Patrik Torstensson <patrik.torstensson@labs2.com>
[mono.git] / mcs / class / System.Web / System.Web / HttpServerUtility.cs
index e58e1db1aaffae8fa25b2713eef2090fd8eb0fc0..c41d72d9d56340e4a43f03e12ca9350e26c2e96b 100644 (file)
@@ -19,20 +19,23 @@ using System;
 using System.IO;\r
 \r
 namespace System.Web {\r
-   /// <summary>\r
-   /// System.Web.\r
-   /// </summary>\r
    public sealed class HttpServerUtility {\r
 \r
       private static string _name = "";\r
 \r
       private HttpContext _Context;\r
+      private HttpApplication _Application;\r
                \r
       [MonoTODO()]\r
-      public HttpServerUtility(HttpContext Context) {\r
+      internal HttpServerUtility(HttpContext Context) {\r
          _Context = Context;\r
       }\r
                \r
+      [MonoTODO()]\r
+      internal HttpServerUtility(HttpApplication app) {\r
+         _Application = app;\r
+      }\r
+\r
       // Properties\r
 \r
 \r
@@ -66,7 +69,14 @@ namespace System.Web {
       /// Clears the previous exception.\r
       /// </summary>\r
       public void ClearError() {\r
-         _Context.ClearError();\r
+         if (null != _Context) {\r
+            _Context.ClearError();\r
+            return;\r
+         }\r
+\r
+         if (null != _Application) {\r
+            _Application.ClearError();\r
+         }\r
       }\r
 \r
                \r
@@ -185,6 +195,10 @@ namespace System.Web {
       /// <param name="path">The virtual path on the Web server. </param>\r
       /// <returns>The physical file path that corresponds to path.</returns>\r
       public string MapPath(string path) {\r
+         if (null == _Context) {\r
+            throw new HttpException("MapPath is not available");\r
+         }\r
+\r
          return _Context.Request.MapPath(path);\r
       }\r
 \r