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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to files

Status
Not open for further replies.

jonathanmb

Technical User
Feb 19, 2003
93
US
Surely this has been covered in a pervious thread, but searching through the forum continues to timeout for me.

This may be more approprate in a IIS Forum rather than here, but I'm starting here.

I'm receiving an Error 70 Permission Denied error when trying to write/modify a file on the server. The IUSR account does have modify access to the folder, I've even tried giving the account full access with no luck. I've even dumbed down the code to an extremly simple example with no success.

Code:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(Server.MapPath("test.txt"), 8, True)
f.Write "test"
f.Close
Set f = Nothing
Set fso = Nothing

That seems to be about as simple as I can get, and I still receive the Permission Denied error. Are there any other permissions that the IUSR needs in order to write a file to a given folder other than modify permission to the folder the VBScript wants to write to? I must be missing something.
 
Do you have "execution permissions" set to "Scripts only"? Are you allowing anonymous access?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Yeah, I am allowing anonymous access with the IUSR account set as the account to use for anonymous access. The execution permissions is also set to "Scripts only."

I happen to have a couple of IIS boxes here at my disposal, so I the script on a differnt box. It works on the different server. Both of these boxes are running Windows 2000 Server and IIS 5. I'm trying to figure out what's different between them with no luck so far.
 
Are you sure that it is finding "test.txt"?

Set fso = CreateObject("Scripting.FileSystemObject")
if fso.fileExists(Server.MapPath("test.txt")) then
Set f = fso_OpenTextFile(Server.MapPath("test.txt"), 8, True)
f.Write "test"
f.Close
Set f = Nothing
else
response.write "not found"
end if

Set fso = Nothing

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Yeah, if I change it to open for reading rather than writing or appending, the file opens fine and can have its content read with no problem.
 
Definitely a permissions problem (but you already knew that). The two places to look are in the IIS and the folder itself. On my PC, the account is IUSER_WEB.....

Sorry I can't help more

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
I greatly appreciate the help you've given. Thanks for your time.
 
It's not an ASP problem but rather an IIS and Pemrissions oversight.

When you're on a domain, assigning user permissions brings up the domain's users/groups by default. So I was assigning permissions for the domain's IUSR account.

By default, IIS uses the local work station's IUSR account for anonymous access and not the domain's IUSR account if the server is a member of the domain.

So my problem came in that I gave Modify permissions to the wrong IUSR account. Two ways to fix it. I could give permissions to the local workstation's IUSR account or tell IIS to use the domain's IUSR account for anonymous access.

Yes, it took me 4 days to find something that simple. There's a reason why my friends call me the Chief Newb. But then again, I'm not an IIS guy. Apache all the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top