Saving an ASP form to a text file

K

Kevin Ingram

Ok, this is probably a silly question but I just keep hitting a brick wall
here.

I usually develop my sites entirely in ASP and use a database for data
storage, works great for me. I also sometimes save information to a text
file on my server like c:\invoices\customername.txt for batch processing
later... I use the FSO commands and it all works slick.

Now, I have a new project: A client wants us to log in to their website on
another server, and program some pages for them. Very simple stuff, mostly
created with FrontPage, I added a couple of ASP pages and they work fine...
but I have one thing I cannot get to work:

They want the results of a form saved into a text file that they will FTP
later. They created the form in FrontPage as follows:

<form method="POST" action="_derived/nortbots.htm"
onSubmit="location.href='_derived/nortbots.htm';return false;"
webbot-action="--WEBBOT-SELF--"
WEBBOT-onSubmit="location.href='_derived/nortbots.htm';return false;">
<!--webbot bot="SaveResults" S-Label-Fields="TRUE"
U-File="_private/kform_results.txt" S-Format="TEXT/CSV" startspan --><input
TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults"
endspan i-checksum="43374" --><p><input type="text" name="T1"
size="20"><input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"></p>
</form>

This saves the results of the form in a text file in their server. I want to
do this, but can't get the above form to work from an ASP page, it looks
like it only accepts it from a page with an HTM extension. Normally I would
use the FSO command and write the data to a specific location on the server,
but its not my server so I have no control over where to write it.

So... my simple question is: How can I get the results of a form on an ASP
page to dump into a text file that the client can just FTP later from their
site? or.... even into another HTM page on the same site? They could just
read it there....

I am using Visual Studio 6, writing the pages in Visual InterDev.

Thanks!
 
R

Ray at

Dim oFSO, thing, sContents

For Each thing in Request.Form
sContents = sContents & thing & "=" & Request.Form(thing) & vbCrLf
Next

Set oFSO = CreateObject("Scripting.FilesystemObject")
oFSO.CreateTextfile("C:\file.txt").Write sContents
Set oFSO = Nothing
 
K

Kevin Ingram

Can't use FSO. If you notice in my original post, the problem is that it's
not my server and I don't have a specific file path for the file, just want
it to reside in the domain folder.

Or can FSO be modified to just save the file in the current domain folder?
 
R

Ray at

How does that negate the FSO? You can Server.MapPath to get the path on the
server.

sPath = Server.MapPath("filename.txt")
 
K

Kevin Ingram

That was the information I was missing, how to use the current location....
but now I have a new problem, when I run this I get a Permission Denied
error, I'm assuming the host has denied write access to the IUSR_machine
account on this site. Is there any way to get around that? How does
FrontPage accomplish a write, and ASP cannot? Am I missing something simple,
or can this not be done with ASP?

Thanks!
 
R

Ray at

Kevin Ingram said:
That was the information I was missing, how to use the current location....
but now I have a new problem, when I run this I get a Permission Denied
error, I'm assuming the host has denied write access to the IUSR_machine
account on this site. Is there any way to get around that? How does
FrontPage accomplish a write, and ASP cannot? Am I missing something simple,
or can this not be done with ASP?

This definitely can be done with ASP, but you're probably right about the
IUSR permissions. My guess for Frontpage is that Frontpage server
extensions run as a service on the server, which would [likely] mean that
the service is running under the local system account which will have full
permissions on the file system. But, I'm just guessing about this, as I
have never read up on Frontpage extensions or anything.

If the client wants file creation, they'll have to have the host give write
permissions to the IUSR account. Or, you can try the Frontpage server
extensions route. I wouldn't know where to start with that though!

Ray at home
 
K

Kevin Ingram

That's just it, I don't have access to the permissions to change them on
that server. I was hoping maybe someone had another workaround, or a way to
get the original form to work from an ASP page.

Thanks!
Kevin Ingram said:
That was the information I was missing, how to use the current location....
but now I have a new problem, when I run this I get a Permission Denied
error, I'm assuming the host has denied write access to the IUSR_machine
account on this site. Is there any way to get around that? How does
FrontPage accomplish a write, and ASP cannot? Am I missing something simple,
or can this not be done with ASP?

This definitely can be done with ASP, but you're probably right about the
IUSR permissions. My guess for Frontpage is that Frontpage server
extensions run as a service on the server, which would [likely] mean that
the service is running under the local system account which will have full
permissions on the file system. But, I'm just guessing about this, as I
have never read up on Frontpage extensions or anything.

If the client wants file creation, they'll have to have the host give write
permissions to the IUSR account. Or, you can try the Frontpage server
extensions route. I wouldn't know where to start with that though!

Ray at home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top