Hyperlink control - embedded spaces converted

Discussion in 'ASP .Net Web Controls' started by Leslie, Jul 13, 2006.

  1. Leslie

    Leslie Guest

    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
    Leslie, Jul 13, 2006
    #1
    1. Advertising

  2. 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.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Leslie" <> wrote in message
    news:...
    >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
    >
    Nathan Sokalski, Jul 14, 2006
    #2
    1. Advertising

  3. Leslie

    Leslie Guest

    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


    "Nathan Sokalski" wrote:

    > 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.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    > "Leslie" <> wrote in message
    > news:...
    > >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
    > >

    >
    >
    >
    Leslie, Jul 14, 2006
    #3
  4. 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 (, 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.
    Walter Wang [MSFT], Jul 16, 2006
    #4
  5. Leslie

    Leslie Guest

    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

    "Walter Wang [MSFT]" wrote:

    > 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 (, 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.
    >
    >
    Leslie, Jul 16, 2006
    #5
  6. 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 (, 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.
    Walter Wang [MSFT], Jul 17, 2006
    #6
  7. Leslie

    Leslie Guest

    Walter,

    That fixed it.

    Thanks,
    Leslie

    "Walter Wang [MSFT]" wrote:

    > 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 (, 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.
    >
    >
    Leslie, Jul 17, 2006
    #7
  8. 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 (, 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.
    Walter Wang [MSFT], Jul 18, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John B. Matthews
    Replies:
    4
    Views:
    664
    John B. Matthews
    Sep 12, 2008
  2. Roedy Green
    Replies:
    3
    Views:
    620
  3. Tomasz Chmielewski

    [CSS] how can I show spaces as spaces?

    Tomasz Chmielewski, Sep 5, 2009, in forum: HTML
    Replies:
    21
    Views:
    1,589
    Jan C. Faerber
    Sep 10, 2009
  4. Tomasz Chmielewski

    how can I show spaces as spaces, part 2

    Tomasz Chmielewski, Sep 9, 2009, in forum: HTML
    Replies:
    14
    Views:
    870
    Jan C. Faerber
    Sep 10, 2009
  5. johkar
    Replies:
    2
    Views:
    2,877
    Mayeul
    Dec 10, 2009
Loading...

Share This Page