need url parameter separator "&" not "&"

Discussion in 'ASP .Net' started by DC Gringo, Aug 19, 2004.

  1. DC Gringo

    DC Gringo Guest

    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?

    --
    _____
    DC G
     
    DC Gringo, Aug 19, 2004
    #1
    1. Advertising

  2. Use Server.URLEncode to encode the URL properly and you will be fine.

    "DC Gringo" wrote:

    > 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¶m2=y
    >
    > When it serves up the page, I'm getting "&" in place of the "&"
    > separator and my image is not coming up.
    >
    > How can I deal with this?
    >
    > --
    > _____
    > DC G
    >
    >
    >
     
    =?Utf-8?B?QnJhZCBSb2JlcnRz?=, Aug 19, 2004
    #2
    1. Advertising

  3. DC Gringo

    Curt_C [MVP] Guest

    Sounds like and issue for
    UrlDecode() and UrlEncode()

    Curt

    "DC Gringo" <> wrote in message
    news:ur5%...
    >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?
    >
    > --
    > _____
    > DC G
    >
    >
     
    Curt_C [MVP], Aug 19, 2004
    #3
  4. DC Gringo

    mikeb Guest

    DC Gringo wrote:
    > 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.


    --
    mikeb
     
    mikeb, Aug 19, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DC Gringo

    encoding of "&" vs "&amp;" in url

    DC Gringo, Aug 4, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    16,983
    davitz38
    Feb 5, 2010
  2. Replies:
    1
    Views:
    714
    Rosanne
    Oct 11, 2005
  3. FoundThisOnline

    &amp; problem with hyperlink control

    FoundThisOnline, Oct 11, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    2,896
    FoundThisOnline
    Oct 11, 2005
  4. T.J.

    &amp, in URL's

    T.J., Jan 28, 2005, in forum: HTML
    Replies:
    31
    Views:
    7,739
    Duende
    Feb 15, 2005
  5. Sammy
    Replies:
    12
    Views:
    1,230
    Richard Tobin
    May 6, 2005
Loading...

Share This Page