2006-02-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 2 Feb 2006 22:21:38 +0000 (22:21 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 2 Feb 2006 22:21:38 +0000 (22:21 -0000)
* HostingEnvironment.cs: MapPath is done.

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

mcs/class/System.Web/System.Web.Hosting/ChangeLog
mcs/class/System.Web/System.Web.Hosting/HostingEnvironment.cs

index e8128334f4584ac905d01820863b61208521dab9..d1a754b93ec66e21d599e21b86d6b0ddf2a67a84 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HostingEnvironment.cs: MapPath is done.
+
 2006-02-02 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * DefaultVirtualDirectory.cs: implemented missing bits.
index 4f87d2cdadd08431cfcb9fce64b20bba63a3a13c..cec31873dd64c68ccd51467d561c529af7d7df48 100644 (file)
@@ -34,6 +34,7 @@
 using System;
 using System.Security.Permissions;
 using System.Web.Caching;
+using System.Web.Util;
 
 namespace System.Web.Hosting {
 
@@ -128,10 +129,21 @@ namespace System.Web.Hosting {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
                public static string MapPath (string virtualPath)
                {
-                       throw new NotImplementedException ();
+                       if (virtualPath == null || virtualPath == "")
+                               throw new ArgumentNullException ("virtualPath");
+
+                       if (UrlUtils.IsRelativeUrl (virtualPath)) {
+                               string msg = String.Format ("The relative virtual path '{0}', is not allowed here.", virtualPath);
+                               throw new ArgumentException (msg);
+                       }
+
+                       HttpContext context = HttpContext.Current;
+                       if (context == null)
+                               return null;
+
+                       return context.Request.MapPath (virtualPath);
                }
 
                [MonoTODO]