473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Developement questions

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

May 15 '07 #1
5 1348
On May 15, 4:41 pm, "Lloyd Sheen" <a...@b.cwrote:
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

May 15 '07 #2

"Alexey Smirnov" <al************@gmail.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
On May 15, 4:41 pm, "Lloyd Sheen" <a...@b.cwrote:
>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

May 15 '07 #3
On May 15, 11:28 pm, "Lloyd Sheen" <a...@b.cwrote:
"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message

news:11*********************@o5g2000hsb.googlegrou ps.com...
On May 15, 4:41 pm, "Lloyd Sheen" <a...@b.cwrote:
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?

May 15 '07 #4

"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
On May 15, 11:28 pm, "Lloyd Sheen" <a...@b.cwrote:
>"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message

news:11*********************@o5g2000hsb.googlegro ups.com...
On May 15, 4:41 pm, "Lloyd Sheen" <a...@b.cwrote:
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

May 16 '07 #5
On May 16, 5:19 pm, "Lloyd Sheen" <a...@b.cwrote:
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!

May 16 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: RichG | last post by:
We are building a new developement system specifically for .NET developement. We will bw using VB. and C#. What will be the best OS to install on the new system. What will be the best concidering...
5
by: RichG | last post by:
We are building a new developement system specifically for .NET developement. We will bw using VB. and C#. What will be the best OS to install on the new system. What will be the best concidering...
4
by: jack | last post by:
HI all i dont know whether to ask this question in this group or not i just want to do proper step wise developement like planning and then codeing and then testing etc i have just got a...
4
by: csgraham74 | last post by:
Hi Guys, I was hoping someone could point me in the right direction regarding a new software developement. Basicallly i have a friend who wants me to develop a dynamic system in ASP.Net that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.