-
Path not found error
Hi,
I am able to run the following code ok from asp:
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objF = objFSO.OpenTextFile("c:\temp\test.txt")
When i try to pass a variable as the file location i.e:
dim temppath
temppath = CStr("c:\temp\test.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objF = objFSO.OpenTextFile(temppath)
I get the following error:
Microsoft VBScript runtime error '800a004c'
Path not found
I cannot work this out as surely i have already dclared the variable as a
styring with the 'CStr' statement?????
Any ideas????
simon
-
Re: Path not found error
Simon
That code looks okay. Check the directory permissions.
>>One important thing to keep in mind when using the FileSystemObject is
permissions! In Windows NT, there are three types of permissions: Read,
Write, and Full Access. Whenever an ASP page attempts to execute some file
system command using FSO, the anonymous web user ID is used:
IUSR_machinename (i.e., if your webserver is named Bob, the user ID is
IUSR_Bob). If IUSR_machinename doesn't have permissions to Read for a
particular directory, you cannot use FSO to read the contents of a file in
that directory through an ASP page. If IUSR_machinename doesn't have
permissions to Write for a particular directory, you cannot use FSO to write
a file to that directory through an ASP page. If IUSR_machinename doesn't
have Full Access permissions for a particular directory, you cannot use FSO
to delete or move a file from that directory through an ASP page. <<
http://www.4guysfromrolla.com/webtec...ect/faq1.shtml
Andrew
-
Re: Path not found error
On 10 Sep 2002 10:00:30 -0700, "simon" <chamberssh@hotmail.com> wrote:
¤
¤ Hi,
¤
¤ I am able to run the following code ok from asp:
¤
¤ Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
¤ Set objF = objFSO.OpenTextFile("c:\temp\test.txt")
¤
¤ When i try to pass a variable as the file location i.e:
¤
¤ dim temppath
¤ temppath = CStr("c:\temp\test.txt")
¤ Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
¤ Set objF = objFSO.OpenTextFile(temppath)
¤
¤ I get the following error:
¤
¤ Microsoft VBScript runtime error '800a004c'
¤
¤ Path not found
¤
¤ I cannot work this out as surely i have already dclared the variable as a
¤ styring with the 'CStr' statement?????
I believe this is a permissions issue. See the following MS KB article:
PRB: Cannot Access Remote Files with the FileSystemObject
http://support.microsoft.com/default...LNG=ENG&SA=PER
Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks