Image URL from Database with spaces doesn't work

  • Thread starter Magnus Blomberg
  • 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
 
R

recoil

%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.
 
M

Magnus Blomberg

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
 
R

recoil

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.
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top