2006-08-09 Robert Jordan <robertj@gmx.net>
authorRobert Jordan <robertj@gmx.net>
Wed, 9 Aug 2006 13:01:40 +0000 (13:01 -0000)
committerRobert Jordan <robertj@gmx.net>
Wed, 9 Aug 2006 13:01:40 +0000 (13:01 -0000)
* Control.cs: add the 2.0 ResolveClientUrl method.
Expose ResolveClientUrl as internal for the 1.1 profile.
Fixes bug #77539.

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

mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/Control.cs

index 6ce2545f2c37250ce6a26ddb82f42ea21a1525f8..e0853a8b281498efdc4bcb8ce06854be16f8b700 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-09  Robert Jordan  <robertj@gmx.net>
+
+       * Control.cs: add the 2.0 ResolveClientUrl method.
+       Expose ResolveClientUrl as internal for the 1.1 profile.
+       Fixes bug #77539.
+
 2006-08-08  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * added MasterPageParser.jvm.cs
index 56d8ddafa3e8d4fea476596d4549587e5239a7ad..c82861604f69bf8b4c23971cdd0d6240c42c6bc9 100644 (file)
@@ -1129,6 +1129,34 @@ namespace System.Web.UI
                        HttpResponse resp = Context.Response;
                        return resp.ApplyAppPathModifier (UrlUtils.Combine (ts, relativeUrl));
                }
+
+
+#if NET_2_0            
+               public
+#else
+               internal
+#endif
+               string ResolveClientUrl (string relativeUrl)
+               {
+                       if (relativeUrl == null)
+                               throw new ArgumentNullException ("relativeUrl");
+
+                       if (relativeUrl == "")
+                               return "";
+
+                       if (relativeUrl [0] == '#')
+                               return relativeUrl;
+                       
+                       string ts = TemplateSourceDirectory;
+                       if (ts == "" || !UrlUtils.IsRelativeUrl (relativeUrl))
+                               return relativeUrl;
+
+                       HttpResponse resp = Context.Response;
+                       string absoluteUrl = resp.ApplyAppPathModifier (UrlUtils.Combine (ts, relativeUrl));
+                       if (absoluteUrl.StartsWith (ts + "/"))
+                               return absoluteUrl.Substring (ts.Length + 1);
+                       return absoluteUrl;
+               }
                
                internal bool HasRenderMethodDelegate () {
                        return _renderMethodDelegate != null;
@@ -1471,11 +1499,6 @@ namespace System.Web.UI
                        get { return skinId; }
                        set { skinId = value; }
                }
-               
-               public string ResolveClientUrl (string url)
-               {
-                       throw new NotImplementedException ();               
-               }
 
                ControlBuilder IControlBuilderAccessor.ControlBuilder { 
                        get {throw new NotImplementedException (); }