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="http://pics.10026.com/?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="http://pics.10026.com/?src=WebResource.axd?d=[value]&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=", "&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.
Why not HttpUtility.UrlEncode(..) ?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.
hello.
how about using registerclientresource?
No comments:
Post a Comment