Forum Moderators: open

Message Too Old, No Replies

This should be easy.

Posting form data to text file...

         

fuzzybunny0

8:24 pm on Oct 31, 2005 (gmt 0)

10+ Year Member



Trying to update a text file from a form..

form page...

<form name="ContactUs" method="post" action="network_status_updater_confirm.asp">
<p>New Network Status:</p>

<textarea cols="60" name="Comments"></textarea><br>

<input type="submit" name="Submit" value="Submit">
</form>

confirm page

<%
' Create instance of FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

' Create the text file
Set myFile = objFSO.CreateTextFile(Server.MapPath("news.txt"))

' Write each Form key and value to the text file created above
myFile.WriteLine Request.Form("Comments")

myFile.Close
%>
---header, body tags etc---
<%
Set fileObj=Server.CreateObject("Scripting.FileSystemObject")
Set listFile=fileObj.OpenTextFile(Server.MapPath("news.txt"), 1)
Response.Write(listFile.ReadLine)
listFile.Close
Set listFile=Nothing
Set fileObj=Nothing
%>

It works on one server im testing on (dont know specs), but my production server (IIS 6) gives me a 500 error after submit.

any help would be greatly appreciated

fuzzybunny0

8:37 pm on Oct 31, 2005 (gmt 0)

10+ Year Member



after turning off friendly messages in IE

it gives me an error on line 6:

Set myFile = objFSO.CreateTextFile(Server.MapPath("news.txt"))

mattglet

9:13 pm on Oct 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you provide the exact error message?

My first quick thought is that you probably don't have adequate permission to create files on the server. Make sure your IIS account has Read/Write permissions available to it.

fuzzybunny0

12:25 pm on Nov 1, 2005 (gmt 0)

10+ Year Member



Microsoft VBScript runtime error '800a0046'

Permission denied

/helpdesk/network_status_updater_confirm.asp, line 6

mattglet

2:14 pm on Nov 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure your IIS account has Read/Write permissions available to it.

fuzzybunny0

2:38 pm on Nov 1, 2005 (gmt 0)

10+ Year Member



thanks, now i get to go and fight with IT

mattglet

4:16 pm on Nov 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It shouldn't be too big of a fight... you only need the access to that one file, not anything big.

fuzzybunny0

12:55 pm on Nov 2, 2005 (gmt 0)

10+ Year Member



they say "This file already has the attributes of read and write."

but its still giving me an error:

Microsoft VBScript runtime error '800a0046'

Permission denied

/helpdesk/network_status_updater_confirm.asp, line 4

(the line number changed because i removed comments from my code)

mattglet

3:24 pm on Nov 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might need "Modify" permissions as well, I can't remember off the top of my head. Long story short, your problem is that the IIS account doesn't have adequate permissions to be able to write to the file. You will need to discuss with IT how to get you those permissions.

beauzero

7:48 pm on Nov 2, 2005 (gmt 0)

10+ Year Member



The difference can also be how 2003 is set up. If you test box is a hard core "reformat" or was created clean. Then in in all likely hood you are running in "IIS 6.0" mode. If the production boxes have old ASP code etc. then IIS 6.0 is performing more like IIS 5.x

Permissions needed to write to files are significantly different. I had some similar problems just trying to access .xsd files from the same box vs. having to do it through a remote connection.

Keep us posted on what you find.

fuzzybunny0

9:59 pm on Nov 2, 2005 (gmt 0)

10+ Year Member



I searched around and found that modifying the CDonts.dll and its containing directory to have read / write permissions usually fixes it, I suggested it to my IT dept, and they got it working, I can only assume that is what they changed.

Thanks for your help