need url parameter separator "&" not "&"

D

DC Gringo

I have an image control (that pulls an image off an ESRI map server):
<ASP:IMAGE ID="imgZonedCountry" RUNAT="server"></ASP:IMAGE>

In the code behind I am setting the ImageURL to a String value with url
parameters like this:

imgZonedCountry.ImageUrl =
"http://server/servlet/com.esri.wms.Esrimap?param1=x&param2=y

When it serves up the page, I'm getting "&amp;" in place of the "&"
separator and my image is not coming up.

How can I deal with this?
 
M

mikeb

DC said:
I have an image control (that pulls an image off an ESRI map server):
<ASP:IMAGE ID="imgZonedCountry" RUNAT="server"></ASP:IMAGE>

In the code behind I am setting the ImageURL to a String value with url
parameters like this:

imgZonedCountry.ImageUrl =
"http://server/servlet/com.esri.wms.Esrimap?param1=x&param2=y

When it serves up the page, I'm getting "&amp;" in place of the "&"
separator and my image is not coming up.

How can I deal with this?

The framework keeps an internal table of HTML attributes which contains
(among other things) a flag that indicates whether the attribute should
be HTML encoded by default. The "src" attribute is set to be encoded,
and the control rendering in the Image webcontrol seems to render
attributes with the default for the encoding setting - I don't think
there's a simple way to control this.

I think that you should be able to get this to work by

1) subclassing the Image control,
2) override the AddAttributesToRender() method,
3) in that method, render the "src" attribute yourself,
4) remove the src attribute form the control's attribute collection,
then
5) call the base.AddAttributesToRender() method so the rest of the
attributes will be written out.

Then, of course, you'd use your new Image-derived control instead.

Maybe there's a simpler way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top