Getting permission denied error when writing to TXT file in ASP

I am trying to execute the code below from a web page on an IIS server to record the responses that a user enters into the page.

I get an error "800a0046" which when I Googled says permission denied.

At this point I am running this from localhost as an admin on the box. I have tried writing to C:\ and C:\inetpub\wwwroot. Any ideas?


thanks,
ob1
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject") 
set f=fs.CreateTextFile("c:\inetpub\wwwroot\test.txt",true)
f.write("Hello World!")
f.write("How are you today?")
f.close
set f=nothing
set fs=nothing

Open in new window

LVL 6
ob1_Asked:
Who is Participating?
 
jtlowe22Commented:
I'm not sure what's going on but make sure your ASP.Net application has write access to the directory you are trying to save the file to.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
I'm surprised it doesn't work for you locally, but you can try giving permissions to the aspnet_wp account for the folder you want to write to and see if that helps.
0
 
ob1_Author Commented:
i gave permissions to IUSR and IUSRS group and used "GetFolder" method to specify folder as well as text file. this seems to work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.