[Mono-dev] (no subject)

Andrew Skiba andrews at mainsoft.com
Thu Jul 27 05:33:44 EDT 2006


Hi, Gonzalo. 

Following our IRC conversation, I made some investigation. On 2.0 when I
tried to render <asp:table> with BackImageUrl="~/c:\aaa.jpg" I've got
the following exception stacktrace:

[HttpException (0x80004005): '~/c:\aaa.jpg' is not a valid virtual
path.]
   System.Web.Util.UrlPath.CheckValidVirtualPath(String path) +210
   System.Web.Util.UrlPath.Combine(String appPath, String basepath,
String relative) +154
   System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +377
 
System.Web.UI.WebControls.TableStyle.FillStyleAttributes(CssStyleCollect
ion attributes, IUrlResolutionService urlResolver) +51
   System.Web.UI.WebControls.Style.AddAttributesToRender(HtmlTextWriter
writer, WebControl owner) +204
 
System.Web.UI.WebControls.TableStyle.AddAttributesToRender(HtmlTextWrite
r writer, WebControl owner) +27
 
System.Web.UI.WebControls.WebControl.AddAttributesToRender(HtmlTextWrite
r writer) +378
   System.Web.UI.WebControls.Table.AddAttributesToRender(HtmlTextWriter
writer) +38
   System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter
writer) +17
   System.Web.UI.WebControls.Table.RenderBeginTag(HtmlTextWriter writer)
+16
   System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)
+17

On dotnet 1.1 I could not cause such exception no matter what URL I gave
to BackImageUrl. Except that, I saw, that on dotnet
ResolveUrl("aaa.jpg") returns "aaa.jpg". So our Control.ResolveUrl
should be fixed, because now it always returns an absolute path,
including the application name. After that fix, on 1.1 ResolveUrl should
be sufficient for TableStyle.AddAttributesToRender.

On 2.0 I decided to make a minimal patch to fix my test, because I don't
want to make big changes right now.

If I had more time, I would do some refactoring, to make our call stack
look similar to dotnet. There is lots of code duplication in our code in
Style.WriteStyleAttributes, Style.FillStyleAttributes,
TableStyle.FillStyleAttributes and TableStyle.AddAttributesToRender.

Also, I decided not to try and find what ResolveClientUrl does. Its
difference from ResolveUrl is undocumented, and can change. So I see no
value in copying .Net behaviour, until clients will come with real
testcases. I implemented the bare minimum to make my test pass.

I attach the minimal patch for your review.

Thank you.
Andrew.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TableStyle.patch
Type: application/octet-stream
Size: 1383 bytes
Desc: TableStyle.patch
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060727/e45cc2fc/attachment.obj 


More information about the Mono-devel-list mailing list