url creation problem

M

^MisterJingo^

Hi all,

I've created an app which allows a directory to be browsed. If a file
is clicked, I use ResolveUrl() to convert the directory path to a url
path. I then attach the file name to the end of it.
This works perfectly for all files but one. The name of the file is
"lead ECG B&W.pdf" It seems the '&' is the cause as all characters
after it (including it) are missing from the url. I'm unsure how to get
over this problem, so any help would be appreciated.

Thanks.

Ps. THe code I use can be found here:

tempFile = Request.QueryString["f"];

url += ResolveUrl(getLocation()) + tempFile;


F contains the file name.
url is a string which contains the the website base address.
getLocation contains the current location in the directory structure.

I know I can use stringbuilder to make it more efficient - I will do
this, but i'm currently just trying to get it to work,
 
T

Tarren

Server.URLEncode on the sender
Server.URLDecode on the receiver

This will handle any special characters which are automatically converted
to/from the hex equivalent. with the %
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top