Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An ampersand in an image URL

Status
Not open for further replies.

grande

Programmer
Feb 14, 2005
657
CA
Hi all,

I have an ASP:Image control that is having its ImageUrl populated by the C# code-behind file.

The image URL is:
[product_number]_main.axs&80&80

As you can see, there's a few ampersands in the URL. However, when it gets put to the page, the <IMG> tag generated has the URL as:
[product_number]_main.axs&amp;80&amp;80

Is there a way I can get around this?

(PS: If I put the string directly into an <IMG> tag, and Response.Write it to the screen, it works fine)

-------------------------
Call me barely Impressive Captain.
 
can you paste the line of code where you are generating the imageURL?

Have you looked at the help for concatting "&"?

SWM Programmer Seeking 3d Modeling work. Either for long term commitment or just friendship. Likes long hours in front of a flat screen with heavy doses of Mountain Dew.
 
I'm generating my string thusly:
Code:
string iu = ConfigurationManager.AppSettings["imageserver_thumburl"];
string DisplayThyImage = HttpUtility.UrlDecode(iu);
DisplayThyImage = DisplayThyImage.Replace("@@image", Results.Product_Thumbnail + ".axs");
DisplayThyImage = DisplayThyImage.Replace("@@w", "80");
DisplayThyImage = DisplayThyImage.Replace("@@h", "80");
imgThumbnail.ImageUrl = DisplayThyImage;

The imageserver_thumburl contains the following string:

-------------------------
Call me barely Impressive Captain.
 

The imageserver_thumburl contains the following string:


is the string coming out of .AppSettings with the &amp or is this being generated somewhere else? If its coming out of .AppSettings, are you sure that its not coded in .AppSettings that way?

what does "DisplayThyImage" contain immediately after:
Code:
string DisplayThyImage = HttpUtility.UrlDecode(iu);


SWM Programmer Seeking 3d Modeling work. Either for long term commitment or just friendship. Likes long hours in front of a flat screen with heavy doses of Mountain Dew.
 
try this:

imgThumbnail.Attributes("Src")=DisplayThyImage;

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top