Hyperlink control - embedded spaces converted

L

Leslie

I am using Hyperlink controls. The image URL property references images that
are stored on the local file system in the user's temp folder. The path
reference contains blanks as you would expect in C:\Documents and Settings.
The embedded blanks are being converted to %20 so the string shows up in the
HTML source as C:\Documents%20and%20Settings. As a result, the browser cannot
find the images.

The 1.1 framework did not do this conversion.

Is there a way to turn off this conversion?

Thanks,

Leslie
 
N

Nathan Sokalski

Well, I can't answer your question right now (I recently switched from 1.1
to 2.0), but I would like to ask 2 questions. First, why are you trying to
access files in the C:\Documents and Settings directory with an ASP.NET
application? Second, I think that you would need to use the file:// protocol
to do what you are doing, since you specify the drive. The reason the spaces
are converted to %20 is because spaces are not legal in URLs.
 
L

Leslie

Nathan,

The icons referenced with the img tag come from SMS and are obtained using
SMS APIs. Once obtained, they are stored in the user's temp folder. The SMS
SDK made it possibly to obtain the icons but I did not find a way to get a
path to the icon on the SMS server. I store the icons in the temp folder and
pass the reference back to IIS which uses the reference to build the page.

Regarding the protocol, the browser seems to handle the C:\... references
just fine.

About the spaces, I understand they are not used in URLs and normally the
conversion would not be a problem, but in this case it messes up something
that was working before.

I am hoping someone knows a way to turn it off.

Leslie
 
W

Walter Wang [MSFT]

Hi Leslie,

Thank you for your post.

I think the browser cannot find the image file because the image files path
is using server-side local path reference, rather than a remote path which
can be accessed using 'http://...'.

The space gets encoded to %20 is normal behavior.

For a local existing resource that has space in its path, you can verify
that this %20 encoding works by creating a simple html page:

<html>
<body>
<img src="file://c:/program%20files/common%20files/services/bigfoot.bmp" />
</body>
</html>

Of course you should have "c:\program files\common
files\services\bigfoot.bmp" file existing on client.

For your issue using SMS APIs to get the icons rendered on webpage, you
need to copy the icons to a folder which can be accessed from your website,
normally you can copy them to a subfolder "images" under your website (make
sure the ASP.NET service account have write access to this folder) and
reference them using "images/xyz.abc" format.

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Leslie

Hi Walter,

I was unable to get the answer you sent to work. I built a page with the
following html.

<html>
<body>
<img src="C:\Program Files\Common Files\Services\bigfoot.bmp"/>
<img src="file://c:/program%20files/common%20files/services/bigfoot.bmp" />
</body>
</html>

The first img displays correctly, the second does not.

Did the html you sent work on your machine?

Thanks,

Leslie
 
W

Walter Wang [MSFT]

Hi Leslie,

I'm sorry for my typo in the code, should be:

<img src="file:///c:/program%20files/common%20files/services/bigfoot.bmp" />

There're three slash after "file:".




Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Walter Wang [MSFT]

Hi Leslie,

Appreciate your update and response. I am glad to hear that the problem has
been fixed. If you have any other questions or concerns, please do not
hesitate to contact us. It is always our pleasure to be of assistance.

Have a nice day!

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top