ImageButton problem - ImageUrl encodes ampersands!

  • Thread starter Thread starter David Berman
  • Start date Start date
D

David Berman

I'm having a problem with the ImageButton class. I want to set the
ImageURL to an asp page, like:
Thumbnail.ImageURL = "getpicturefromdatabase.aspx?INDEX=52&GALLERY=12";

The problem is, when the control renders, it renders the url incoded as
"getpicturefromdatabase.aspx?INDEX=52&GALLERY=12" so the other page
doesn't process the request correctly. I checked in the debugger and
the value for the property looks to be exactly what I want so somehow it
gets changed when rendered.

I've used the ImageButton class to do this in other places without
trouble, but on this page it keeps converting it. Why? How can I fix
this?

Thank you very much!





<img src="http://www.sen.us/mirror/SENLogo_62_31.jpg">
Meet people for friendship, contacts,
or romance using free instant messaging software! See a picture you
like? Click once for a private conversation with that person!
http://www.sen.us
 
This looks like correct HTML to me. Whenever you have & in an HTML document
it needs to be represented as &amp;, even if it's in an <img src>, <script
src>, or <link href>. The browser understands this and sends "&" in the
querystring when the image is requested from the server. This is often
misunderstood.
 
Back
Top