-
Oct 13th, 2014, 02:12 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Have problem with url and file://
Hi!
I want in ASP generate urls on a web page that point to locally stored files, like a file browser. I build the paths in visual basic code on the server.
The problem is that files with a space in them refuses to encode correctly.
I generate the code like this:
Code:
<td><a href=<%= Replace("file://" + path + "\" + Filename, " ", "%20") %>><%= Filename %></a></td>
With the above code the url (when right click in IE and select properties) looks fine but the %20 has been replaced with %2520. I understand that something is trying to encode the % character.
When I skip the Replace call and do something like this for a file with name "first text.txt":
Code:
<td><a href=<%= "file://" + path + "\" + Filename %>><%= Filename %></a></td>
I get an url like file://mypath\myfolder\first
here this "something" that encodes the % doesn't care about the spaces.
Filename above is a string from the "scripting.filesystemobject" library.
Basically, I want to write an url that points to a file on the local network. I know there are much better ways to do this, but this is a really old asp app, and this is a small new feature that was requested. And I have everything working except this rendering of the actual urls. For folders, the Replace(folder, " ", "%20") works fine for some reason.
HELP!
/Henrik
-
Oct 13th, 2014, 03:01 PM
#2
Re: Have problem with url and file://
Should I move this to the ASP classic forum?
-
Oct 14th, 2014, 03:54 AM
#3
Re: Have problem with url and file://
Originally Posted by dday9
Should I move this to the ASP classic forum?
Yes.
-
Oct 14th, 2014, 05:06 AM
#4
Re: Have problem with url and file://
Originally Posted by dclamp
Yes.
Although, how can you be sure the original poster is using asp and not asp.net? Just because the original poster has written asp that he is not in fact referring to asp.net.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Oct 14th, 2014, 05:42 AM
#5
Thread Starter
Frenzied Member
Re: Have problem with url and file://
Hi!
My mistake, I assumed this part of the forum was for asp classic and vbscript.
I solved it by putting " around the path, seem to work like when you are typing paths with spaces in the command prompt or executing a batch script.
Problem solved.
/Henrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|