UpdatePanel and GetWebResourceUrl

Last post 05-16-2006 8:20 AM by Luis Abreu. 3 replies.

Sort Posts:

  • UpdatePanel and GetWebResourceUrl

    05-15-2006, 4:46 PM
    • Contributor
      3,329 point Contributor
    • billrob458
    • Member since 07-25-2003, 2:44 AM
    • New York, NY
    • Posts 671

    I noticed there are two overloads for GetWebResourceUrl, one allows htmlEncode boolean property and one that defaults to htmlEncode = false.  Of course the only public method is the one that sets htmlEncode = false.  So when I put out a web resource in an atlas update panel it renders the link as:

    <script src=”WebResource.axd?d=[value]&t=[value]></script>

    This is not valid Xml because the & remains unencoded.  However all of the runtimes resource emissions use the internal GetWebResourceUrl method that DOES the html encoding

    <script src=”WebResource.axd?d=[value]&amp;t=[value]></script>

    The only way I have found to get a web resource url through an update panel is to use "hack" code.

    string url = [x].GetWebResourceUrl( ... ).Replace( "&t=", "&amp;t=" )

    which is clearly not good.  When I don't use the replace logic on it, the xml is invalid so the xml DOM is empty, therefore the altas client script blanks out the Panel's UI.

    Is there another workaround I could do?  I think I could get the internal GetWebResourceUrl method called up through reflection, but I shouldn't have to.

  • Re: UpdatePanel and GetWebResourceUrl

    05-15-2006, 7:53 PM
    • Member
      92 point Member
    • berkovitz
    • Member since 04-24-2003, 2:08 PM
    • Toronto, Ontario, Canada
    • Posts 32
    Why not HttpUtility.UrlEncode(..) ?
    -Steven Berkovitz
    MBC Computer Solutions Ltd.
    http://www.mbccs.com
  • Re: UpdatePanel and GetWebResourceUrl

    05-15-2006, 8:14 PM
    • Contributor
      3,329 point Contributor
    • billrob458
    • Member since 07-25-2003, 2:44 AM
    • New York, NY
    • Posts 671

    Thanks for responding, but UrlEncode will encode the entire string using % chars.

    WebResource.axd?f=asdfasdf&t=00001

    Will be encoded as

    WebResource.axd%3ff%3dasdfasdf%26t%3d00001

    which is not a valid url for my application.

  • Re: UpdatePanel and GetWebResourceUrl

    05-16-2006, 8:20 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello.

    how about using registerclientresource?

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
Page 1 of 1 (4 items)