Solved

File System Object - How to encode path with spaces

Posted on 2004-03-24
13
787 Views
Last Modified: 2006-11-17
This should hopefully be easy...

If I use the following:

Set folder = fso.GetFolder("C:\Test\")

There are no problems, however if I change the directory to the following:

Set folder = fso.GetFolder("C:\Documents and Settings\Bill\My Documents\My Pictures\")

I get a "path not found error" or more specifically:
Microsoft VBScript runtime (0x800A004C)
Path not found
/alpha/UploadFromFolder.asp, line 110

I'm thinking it has something to do with the spaces in the filename since this is really the only difference (besides length).  Does anyone have any suggestions?

Thanks!
0
Comment
Question by:willy6743
  • 5
  • 2
  • 2
  • +3
13 Comments
 

Author Comment

by:willy6743
ID: 10673697
Looking at this a little further, I found that the path works up to the following point:

Set folder = fso.GetFolder("C:\Documents and Settings\Bill\")

However it is after I try to go another level deeper, I run into the problems.  Is this a security issue?  And if so, how can I get around it so that I can point to the 'My Pictures' folder?

Thanks!
0
 
LVL 4

Expert Comment

by:AsbjornG
ID: 10674012
Try this, it's the way windows would want you to write it:


Set folder = fso.GetFolder("""C:\Documents and Settings\Bill\My Documents\My Pictures\""")

Cheers,

Asbjorn
0
 

Author Comment

by:willy6743
ID: 10674378
I gave that a try and got the same error message.  It didn't seem to mind the extra quotes but it also did not accept them.

Thanks.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 3

Expert Comment

by:xiong8086
ID: 10674641
use SERVER.URLENCODE("")

Set folder = fso.GetFolder(SERVER.URLENCODE("C:\Documents and Settings\Bill\My Documents\My Pictures\")),

;-)
0
 
LVL 4

Expert Comment

by:AsbjornG
ID: 10674704
How about this? (My local setup is bugged, so I'm afraid I can't test myself at the moment)

dim strDir

strDir = "C:\Documents and Settings\Bill\My Documents\My Pictures\"

Set folder = fso.GetFolder(strDir)

Asbjorn
0
 
LVL 6

Accepted Solution

by:
BAlexandrov earned 50 total points
ID: 10675027
Yes, it is permissions issue of course! To profile for every user by default have access only this user (and administrators)
Set correct permissions on folder and it will work. You will have to add IUser*** user (or Guests group) to have read or write access or choose different directory.

Bojidar Alexandrov
0
 
LVL 7

Expert Comment

by:TheKenman
ID: 10675852
Set folder = fso.GetFolder("C:\Documents%20and%20Settings\Bill\My%20Documents\My%20Pictures\")
0
 
LVL 6

Expert Comment

by:pillbug22
ID: 10677295
I would agree with BAlexandrov.  It is probably a security issue, especially if your web page is running under the default IUSER account (whihc woudn't have access to those foldes unless you specify so).

If you are using Basic or Windows Integrated login, you'll have to make sure the user has access as well.
0
 

Author Comment

by:willy6743
ID: 10678299
I will be unable to test until tonight, but I believe you are right with the security issue.  

Is there any way to run a certain page as a user other than IUSER?

I will try setting the IUSER security to this account.  Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?  Maybe by using a reg file with the registry or with command line commands (maybe a .bat file)?  I was thinking that I would like to have something in the future that will automatically set all of the properties of folders that I am concerned with at once.

I'll reply this evening on what I find out.  Thanks for all of the suggestions!
0
 
LVL 6

Expert Comment

by:pillbug22
ID: 10678395
* Is there any way to run a certain page as a user other than IUSER?

If you need anonymous connections available, you can go into IIS and change the user account for the connections (change it from IUSER to another user account).

If you are on an intranet site, you could try using Windows Integrated Login, which passes through the credentials of the user currently viewing the page. (Also true if you use Basic Authentication).


* Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?

This is possible by using some Windows Scripts, but I think that would probably be best suited for another question (integretiy of EE PAQs)
0
 

Author Comment

by:willy6743
ID: 10678861
Great info...Thanks!  And I will post elsewhere for the folder permissions question.
0
 
LVL 6

Expert Comment

by:BAlexandrov
ID: 10679529
* Is there any way to run a certain page as a user other than IUSER?
in addition
If you disable anonimous access and enable Basic Authentication and/or Windows Integrated auth you will be asked to authenticate befoer going to page and script will work with your account.

* Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?
Only will mention that command line utility for that is called "cacls'
0
 

Author Comment

by:willy6743
ID: 10680122
Thanks BAlexandrov and pillbug22 for the info.  I'm sure this is the problem so I have accepted BAlexandrov's answer before spending the time to test it.

Thanks!
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Filter Question 8 86
Select only the top record in a left join 13 45
Syntax for query to update table 2 29
MS SQL 2008 and stored prodcures and dates 5 14
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question