I am using ASP to write a text file and then email it. The data also
goes into a sql table (this works fine).
The error is a runtime error and says that the path cannot be found.
Any help would be appreciated!!! Thanks
here is the code:

Function WriteTextFile()


Dim STR

Dim filesys 'Dimension Variables required for File Output
Dim filetxt
Dim getname
Dim path


Set filesys = CreateObject("Scripting.FileSystemObject")
ERROR*** Set filetxt =
filesys.CreateTextFile("c:\www\curtisind.com\" & request.Form("name")
& ".txt", True)

'path = filesys.GetAbsolutePathName("c:\www\curtisind.com\" &
request.Form("name") & ".txt")
'getname = filesys.GetFileName(path)

filetxt.WriteLine(" ")
filetxt.WriteLine(" ")
filetxt.WriteLine(" ")
filetxt.WriteLine(" ")
filetxt.WriteLine("Name: " & Request.Form("name"))
filetxt.WriteLine("Company: " & Request.Form("company"))
filetxt.WriteLine("Email: " & Request.Form("email"))
filetxt.WriteLine("Phone Number: " & Request.Form("phone"))
filetxt.WriteLine("Password: " & Request.Form("password"))
filetxt.WriteLine("Confirm Pasword: " & Request.Form("password2"))

filetxt.WriteLine("----------------------------------------------------------------------------")

filetxt.Close

WriteTextFile = True

End Function

Re: ASP creating & writing to text file error by Ray

Ray
Thu Feb 05 13:22:26 CST 2004

1. Does C:\www\curtisind.com path exist on the server?
2. You should put the contents of Request.Form("name") in a variable,
validate that it's a valid value and then use that. That would be much
preferred over pulling request.form("name") twice and then using
filesys.GetFilename to get the value once again. And if the value is blank
or has invalid characters, your code will fail when it tries to create the
file.

Also make sure that your IUSR account has NTFS permissions to create a file
in this path.

Ray at work

"Tracy" <tracy@ustlink.com> wrote in message
news:4ccf68bc.0402051113.778619b0@posting.google.com...
> I am using ASP to write a text file and then email it. The data also
> goes into a sql table (this works fine).
> The error is a runtime error and says that the path cannot be found.
> Any help would be appreciated!!! Thanks
> here is the code:
>
> Function WriteTextFile()
>
>
> Dim STR
>
> Dim filesys 'Dimension Variables required for File Output
> Dim filetxt
> Dim getname
> Dim path
>
>
> Set filesys = CreateObject("Scripting.FileSystemObject")
> ERROR*** Set filetxt =
> filesys.CreateTextFile("c:\www\curtisind.com\" & request.Form("name")
> & ".txt", True)
>
> 'path = filesys.GetAbsolutePathName("c:\www\curtisind.com\" &
> request.Form("name") & ".txt")
> 'getname = filesys.GetFileName(path)
>
> filetxt.WriteLine(" ")
> filetxt.WriteLine(" ")
> filetxt.WriteLine(" ")
> filetxt.WriteLine(" ")
> filetxt.WriteLine("Name: " & Request.Form("name"))
> filetxt.WriteLine("Company: " & Request.Form("company"))
> filetxt.WriteLine("Email: " & Request.Form("email"))
> filetxt.WriteLine("Phone Number: " & Request.Form("phone"))
> filetxt.WriteLine("Password: " & Request.Form("password"))
> filetxt.WriteLine("Confirm Pasword: " & Request.Form("password2"))
>
>
filetxt.WriteLine("---------------------------------------------------------
-------------------")
>
> filetxt.Close
>
> WriteTextFile = True
>
> End Function



Re: ASP creating & writing to text file error by Aaron

Aaron
Thu Feb 05 13:29:30 CST 2004

http://www.aspfaq.com/2039
http://www.aspfaq.com/2089

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




"Tracy" <tracy@ustlink.com> wrote in message
news:4ccf68bc.0402051113.778619b0@posting.google.com...
> I am using ASP to write a text file and then email it. The data also
> goes into a sql table (this works fine).
> The error is a runtime error and says that the path cannot be found.
> Any help would be appreciated!!! Thanks
> here is the code:
>
> Function WriteTextFile()
>
>
> Dim STR
>
> Dim filesys 'Dimension Variables required for File Output
> Dim filetxt
> Dim getname
> Dim path
>
>
> Set filesys = CreateObject("Scripting.FileSystemObject")
> ERROR*** Set filetxt =
> filesys.CreateTextFile("c:\www\curtisind.com\" & request.Form("name")
> & ".txt", True)
>
> 'path = filesys.GetAbsolutePathName("c:\www\curtisind.com\" &
> request.Form("name") & ".txt")
> 'getname = filesys.GetFileName(path)
>
> filetxt.WriteLine(" ")
> filetxt.WriteLine(" ")
> filetxt.WriteLine(" ")
> filetxt.WriteLine(" ")
> filetxt.WriteLine("Name: " & Request.Form("name"))
> filetxt.WriteLine("Company: " & Request.Form("company"))
> filetxt.WriteLine("Email: " & Request.Form("email"))
> filetxt.WriteLine("Phone Number: " & Request.Form("phone"))
> filetxt.WriteLine("Password: " & Request.Form("password"))
> filetxt.WriteLine("Confirm Pasword: " & Request.Form("password2"))
>
>
filetxt.WriteLine("---------------------------------------------------------
-------------------")
>
> filetxt.Close
>
> WriteTextFile = True
>
> End Function



Re: ASP creating & writing to text file error by tracy

tracy
Thu Feb 05 13:49:32 CST 2004


1. the path does exist on the server.
2. I stored the request.form("name") into NAME and used that. Nothing.

?I'm not sure what IUSR account is.
Also make sure that your IUSR account has NTFS permissions to create a
file
in this path.

Tracy



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Re: ASP creating & writing to text file error by Ray

Ray
Thu Feb 05 14:00:09 CST 2004


"tracy koehler" <tracy@ustlink.com> wrote in message
news:%23XbgtEC7DHA.1592@TK2MSFTNGP10.phx.gbl...
>
> 1. the path does exist on the server.

Okay.


> 2. I stored the request.form("name") into NAME and used that. Nothing.

Where? Do a Response.Write path before you try to create the file.


>
> ?I'm not sure what IUSR account is.

It's the account that is used on the server to run the code in the ASP
pages, in a default configuration. It's a user account, just like tkoehler,
if that's what your username is. This user account needs permissions to
create files in this path.



> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

The reward is that the threads are next to impossible to follow and people
often drop out of these threads that are carried out through developersdex.

Ray at work