building a URL dynamically and URLEncode?

  • Thread starter Thread starter DC Gringo
  • Start date Start date
D

DC Gringo

I am having trouble building a URL the serves up an image
dynamically...something involving the & separating my URL parameters. If I
put the same URL in with & instead of the code-generated &, everything
is fine. I've tried URLEncode and URLDecode in both directions and no dice.
hELP!

'declare and build the URL
Dim theURL As String = ""
theURL = sServerName & _
sPath & _
"servicename=" & sServiceName & _
"&a=" & sRequest & _
"&b=" & sWidth & _
"&c=" & sHeight & _
"&d=" & sFormat & _
"&e=" & sLayers & _
"&f=" & sWmtVer & _
"&g=" & sSrs & _
"&h=" & sBbox

'Set the image's url and alt tag
imgWrsiHome.ImageUrl = HttpUtility.UrlDecode(theURL)


http://theserver.com?servicename=r4...0,admin02&f=1.1.1&g=EPSG:4326&h=5

_____
DC G
 
DC Gringo,

&amp isn't URL Encoding, it is HTML Encoding. Somehow you are encoding it
that way. You can always attempt a URLDecode on the receiving end in case
anything is automatically encoded. I don't see in your code there how that
is happening. Can you post additional code that shows the entire link being
created and displayed?

Thanks,
Ian Suttle
http://www.IanSuttle.com
 
Back
Top