Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateTextFile from filesystem object 1

Status
Not open for further replies.

msalvador

Programmer
Nov 13, 2001
33
IT
<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<%Dim fso, MyFile
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set MyFile = fso.CreateTextFile(&quot;\\gfavaro-nt\temp1\testfile.txt&quot;, True)
MyFile.WriteLine(&quot;This is a test.&quot;)
MyFile.Close
%>

running this script an error accured with the following message:

Microsoft VBScript runtime error '800a0046'

Permission denied

/SelfScan/sswreport/a.asp, line 4


can I create a file using a relative path like \\gfavaro-nt???
 
You need to set the path to the actual directory on the server. It is after all created on the server:

Set MyFile = fso.CreateTextFile(&quot;d:\inetpub\
The permission denied part comes from the lack of security permissions to that folder. Give the everyone group, write access to that folder only. It's adviable to make it a new subfolder somewhere so you're not clogging up other 'legitimate' ones.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top