Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Developement questions

Reply
Thread Tools

Developement questions

 
 
Lloyd Sheen
Guest
Posts: n/a
 
      05-15-2007
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

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-15-2007
On May 15, 4:41 pm, "Lloyd Sheen" <(E-Mail Removed)> 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

 
Reply With Quote
 
 
 
 
Lloyd Sheen
Guest
Posts: n/a
 
      05-15-2007

"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> On May 15, 4:41 pm, "Lloyd Sheen" <(E-Mail Removed)> 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

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-15-2007
On May 15, 11:28 pm, "Lloyd Sheen" <(E-Mail Removed)> wrote:
> "Alexey Smirnov" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) ps.com...
>
> > On May 15, 4:41 pm, "Lloyd Sheen" <(E-Mail Removed)> 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?

 
Reply With Quote
 
Lloyd Sheen
Guest
Posts: n/a
 
      05-16-2007

"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> On May 15, 11:28 pm, "Lloyd Sheen" <(E-Mail Removed)> wrote:
>> "Alexey Smirnov" <(E-Mail Removed)> wrote in message
>>
>> news:(E-Mail Removed) ps.com...
>>
>> > On May 15, 4:41 pm, "Lloyd Sheen" <(E-Mail Removed)> 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

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-16-2007
On May 16, 5:19 pm, "Lloyd Sheen" <(E-Mail Removed)> 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!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET developement without Net Framework Pitaridis Aristotelis ASP .Net 0 01-13-2006 01:06 PM
HL7 v3 - New to developement - Please help Taz XML 0 10-12-2005 10:36 AM
software developement lifecycle ichor ASP .Net 1 07-14-2005 06:27 AM
Think twice before you install "Visual Web Developer 2005 Express Edition Beta1" on your developement machine. bredal Jensen ASP .Net 5 07-07-2004 10:58 AM
Struts vs JWSD( Java Web Service Developement) Paul Java 1 12-16-2003 06:27 PM



Advertisments