Image URL from Database with spaces doesn't work

  • Thread starter Thread starter Magnus Blomberg
  • Start date Start date
M

Magnus Blomberg

Hello!

I have a web that will get images url from a database.
Then I set the ImageURL for a Image control to row("ImgPath").
In the Database this is for example \\server1\path1\my image.jpg
In the ImageURL this should then be file://server1/path1/my%20image.jpg (I
think) but it becomes file://server1/path1/my%2520image.jpg

When I put the address in the browser address field and removes the text 25
in the path everything is working.

Why is the text 25 added?!?! How to solve this?

Best regards
/Magnus
 
%25 is the hex for the %. You may need to UrlDecode your data prior to
setting or storing it . i am not sure what exactly you are doing so you
will need to see when it is applicable.
 
Thanks for your answer!

So it might be a bug here, since I'm using VS 2005 beta 1.
It does some double converting or something?!!?

I have a string surl with \\xx\xx xx.xxx which I set with the code
Image1.ImageURL = surl

The result becomes file://xx/xx%2520xx.xxx
25 should not be there.

How to use UrlDecode. I'm not familiar with that function?

Best regards
/Magnus
 
Something like HttpUtility.UrlDecode(variable)
with System.Web included.

If that still does not work then you will need to do a replacement.
merely converting all %2520 to %20 or " " (space) dpeneding upon what
your specific requirements are.
 
Back
Top