Developement questions

L

Lloyd Sheen

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
 
G

Guest

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
 
L

Lloyd Sheen

Anon User said:
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
 
G

Guest

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?
 
L

Lloyd Sheen

Anon User said:
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 & in the Url.


While composing this I noticed that since the name is displayed in a grid
the actual value has an & 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
 
G

Guest

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 & in the Url.

(&) 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!
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top