Linking to file with spaces XP %2520 mess up.....

G

gregnowlives

Hi i've created a simple website which allows our intranet users to add
files from shared drives on the domain and structure them on web pages.
(bit like sharepoint). These files are then displayed in a treeview
control as links to the file.

Anyway my problem is very annoying. What I've learned so far. As we
know Microsoft struggled to get IE encoded spaces correctly so they
decided to double encode to get this working.

eg)

file:///K:\Department Data\Sales\My file.doc

was converted to:-

file:///K:\Department%2520Data\Sales\My%2520File.doc

and not the normal

file:///K:\Department%20Data\Sales\My%20File.doc

This works great on all machine on our domain but the new XP
professionals sp2s (Haven't got any sp1s so can't test these). All
users are on IE6(doesn't work on ie7 with xp either), so it isn't this.
What is annoying me the most is that if you remove the 25 from %2520,
back to being a 'space' . This works on all machines or if you remove
it all and just put a space in your browser this works too.

Unfortunatly it is not possible or practical to change the names of the
directorys or files to remove the spaces, as these coule be excel
files, which probably have tons of links too.

I would appreciate any advice, as I have been searching msdn or
newsgroups for 4 hours to no avail. If you think this could be posted
anywhere else, let me know.

Thanks in advance

Greg
 
J

Josh

I've done a similar thing, I replaced the spaces in the file names with
underscores and when displaying the file name I changed the undercores to
spaces. Any HREFs to the file use the underscore.
 
G

gregnowlives

Workaround. Unfortunatly couldn't change any of the filenames, so
changed the the links to post back to the server and redirect to
another page using the value of the nodes in the treeview.
(SelectedNodeChanged)

Only way I can think of. This works on all Os's I've tried.
Dim mylink As String = "file:\\" & sender.selectedvalue()
response.redirect(mylink)


You should be able to use this in a seperate window, but it isn't quite
working. I don't need it in another window as yet, so not too fussed
Dim myscript As String = "<script " &
"language='javascript'>window.open('" & mylink & "');</script>"
Page.ClientScript.RegisterStartupScript(GetType(String), "Showfile",
myscript)

Thanks

Greg
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top