Developement questions

Discussion in 'ASP .Net' started by Lloyd Sheen, May 15, 2007.

  1. Lloyd Sheen

    Lloyd Sheen Guest

    I have a couple of questions about URLs.

    I have an app which will allow me to access my music collection if I can
    access the internet.

    It shows a list of Artists / Genres / Search etc which produces a GridView
    list of songs each with a "Play" button. All the code works and I can play
    most of the songs with no problem. It is songs with "special" characters in
    the filename that cause problems. A single quote in the filename or a "\"
    are examples. I am using Javascript to play the songs from a WMP embedded
    object.

    I used code to escape those two characters and then those files worked. Now
    any files with the char "&" don't work. I tried the
    System.Web.HttpUtility.HtmlEncode function but that worked worse than my
    string.replace hack mentioned above. Any ideas how to resolve that in the
    Dot.Net way??

    Also I have a Virtual Directory pointing to my MP3 collection. I want to do
    a replace on the URL created above to reference the files from the virtual
    directory. I am not sure how to do that and if I do I need a method of
    testing. Since I am on Vista and cannot get IIS 7 and VS 2005 Pro to talk
    to each other I need a method to determine whether to do the virtual
    directory replace on the URL when it is accessed thru IIS and not do it when
    I am testing in the VS 2005 environment. Any ideas?

    Thanks

    Lloyd Sheen
    Lloyd Sheen, May 15, 2007
    #1
    1. Advertising

  2. On May 15, 4:41 pm, "Lloyd Sheen" <> wrote:
    > I used code to escape those two characters and then those files worked. Now
    > any files with the char "&" don't work. I tried the
    > System.Web.HttpUtility.HtmlEncode function but that worked worse than my


    You should try the System.Web.HttpUtility.UrlEncode
    Alexey Smirnov, May 15, 2007
    #2
    1. Advertising

  3. Lloyd Sheen

    Lloyd Sheen Guest

    "Alexey Smirnov" <> wrote in message
    news:...
    > On May 15, 4:41 pm, "Lloyd Sheen" <> wrote:
    >> I used code to escape those two characters and then those files worked.
    >> Now
    >> any files with the char "&" don't work. I tried the
    >> System.Web.HttpUtility.HtmlEncode function but that worked worse than my

    >
    > You should try the System.Web.HttpUtility.UrlEncode
    >


    Thanks but that did not work. I am passing the URL to a JavaScript method
    which takes the URL and passes it to an embedded WMP for playing. I need to
    string.replace("\","\\") and string.replace("'","\'") to get any thing to
    work (that is the "\" problem) and if the file name has a "'" it will not
    play as well. The UrlEncode did not change a thing so I have no idea how to
    pass a URL with a file name or folder name with an "&".

    Lloyd Sheen
    Lloyd Sheen, May 15, 2007
    #3
  4. On May 15, 11:28 pm, "Lloyd Sheen" <> wrote:
    > "Alexey Smirnov" <> wrote in message
    >
    > news:...
    >
    > > On May 15, 4:41 pm, "Lloyd Sheen" <> wrote:
    > >> I used code to escape those two characters and then those files worked.
    > >> Now
    > >> any files with the char "&" don't work. I tried the
    > >> System.Web.HttpUtility.HtmlEncode function but that worked worse than my

    >
    > > You should try the System.Web.HttpUtility.UrlEncode

    >
    > Thanks but that did not work. I am passing the URL to a JavaScript method
    > which takes the URL and passes it to an embedded WMP for playing. I need to
    > string.replace("\","\\") and string.replace("'","\'") to get any thing to
    > work (that is the "\" problem) and if the file name has a "'" it will not
    > play as well. The UrlEncode did not change a thing so I have no idea how to
    > pass a URL with a file name or folder name with an "&".
    >
    > Lloyd Sheen


    Does the "\&" {slash and amersand} help?

    If not can you send an example of the generated js?
    Alexey Smirnov, May 15, 2007
    #4
  5. Lloyd Sheen

    Lloyd Sheen Guest

    "Alexey Smirnov" <> wrote in message
    news:...
    > On May 15, 11:28 pm, "Lloyd Sheen" <> wrote:
    >> "Alexey Smirnov" <> wrote in message
    >>
    >> news:...
    >>
    >> > On May 15, 4:41 pm, "Lloyd Sheen" <> wrote:
    >> >> I used code to escape those two characters and then those files
    >> >> worked.
    >> >> Now
    >> >> any files with the char "&" don't work. I tried the
    >> >> System.Web.HttpUtility.HtmlEncode function but that worked worse than
    >> >> my

    >>
    >> > You should try the System.Web.HttpUtility.UrlEncode

    >>
    >> Thanks but that did not work. I am passing the URL to a JavaScript
    >> method
    >> which takes the URL and passes it to an embedded WMP for playing. I need
    >> to
    >> string.replace("\","\\") and string.replace("'","\'") to get any thing to
    >> work (that is the "\" problem) and if the file name has a "'" it will not
    >> play as well. The UrlEncode did not change a thing so I have no idea how
    >> to
    >> pass a URL with a file name or folder name with an "&".
    >>
    >> Lloyd Sheen

    >
    > Does the "\&" {slash and amersand} help?
    >
    > If not can you send an example of the generated js?
    >


    Thanks, the "\&" does not work. Any file with the & either in the folder
    name or file name will not play.

    I have removed the UrlEncode and gone with a strictly string.replace. It
    works as I said for both single quote and back slash.

    I added an alert to the Javascript code and without using the UrlEncode when
    I look at the Url in the WMP player it has a &amp; in the Url.


    While composing this I noticed that since the name is displayed in a grid
    the actual value has an &amp; in the name. I replaced this with \& and that
    works.

    Thanks for the help.

    By the way I solved the problem of where I am executing from by using the
    CurrentExecutionFilePath from the request and determining whether I am
    executing from IIS or VS.

    Thanks again.

    Lloyd Sheen
    Lloyd Sheen, May 16, 2007
    #5
  6. On May 16, 5:19 pm, "Lloyd Sheen" <> wrote:
    > Thanks, the "\&" does not work.


    okay, it does not work

    > I replaced this with \& and that works.


    Huh? It does work.

    What's the diference? :)

    > I added an alert to the Javascript code and without using the UrlEncode when
    > I look at the Url in the WMP player it has a &amp; in the Url.


    (&amp;) is the HTML code for the ampersand symbol (&)

    The URL escaped code for (&) is (%26).
    This is basically what the HttpUtility.UrlEncode returns for (&).

    Cheers!
    Alexey Smirnov, May 16, 2007
    #6
    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. Pitaridis Aristotelis

    .NET developement without Net Framework

    Pitaridis Aristotelis, Jan 13, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    484
    Pitaridis Aristotelis
    Jan 13, 2006
  2. ichor

    software developement lifecycle

    ichor, Jul 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    366
    Yunus Emre ALPĂ–ZEN [MCSD.NET]
    Jul 14, 2005
  3. Paul
    Replies:
    1
    Views:
    435
    Wendy S
    Dec 16, 2003
  4. Taz
    Replies:
    0
    Views:
    411
  5. jack

    proper software developement

    jack, May 30, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    331
    Kevin Spencer
    May 31, 2006
Loading...

Share This Page