[Mono-dev] [PATCH] ASP.NET 2.0 - fix for TemplateSourceDirectory inheritance with master pages

Marek Habersack grendello at gmail.com
Wed Feb 7 17:25:21 EST 2007


Hello,

  The attached diff fixes a situation, where ResolveClientUrl wouldn't work
correctly if it was used from within a control placed in a page that uses a
master page, i.e. if the parenthood tree was like:

System.Web.UI.WebControls.ContentPlaceHolder
  System.Web.UI.HtmlControls.HtmlForm
    ASP.test_master
      ASP.Default_aspx

with the site layout:

Default.aspx
subdir/test.master
subdir/Default.aspx

In such situation, ResolveUrl (called by ResolveClientUrl) would return
incorrect URL for any relative address, in the above case, if invoked from
~/Default.aspx:

ResolveClientUrl("subdir/Default.aspx") == subdir/subdir/Default.aspx

This was due to the fact, that ASP.test_master TemplateSourceDirectory code
(generated by the TemplateControlCompiler) would not reach up to its parent,
but would return "~/subdir" instead of "/".

The diff makes two modifications - first it makes sure TemplateSourceDirectory
always returns a HTTP-absolute URL (e.g. /, /subdir etc) and that any template
control checks for its parent's TemplateSourceDir value before returning its
hard-coded source directory.

please review, thanks

marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ResolveUrl.diff
Type: text/x-patch
Size: 1791 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070207/9b99d0f0/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070207/9b99d0f0/attachment-0001.bin 


More information about the Mono-devel-list mailing list