0
votes

As per title

createobject scripting.filesystemobject IIS 7 - vbscript code is always trying to save file in C:\Windows\System32\inetsrv\ instead of web site folder

and I get a "permission denied" error of course

The file should be being saved in the web site folder.

Any help much appreciated.

edit: The vbscript is being called from a form in a website running under IIS7 on win 7 dev machine. I am not setting any path in this case but when I tried ".\" IIS also attempted to use the "inetsrv" path and not the web site root folder as I was expecting.

1
you need to show your code, although my first guess would be you need to use Server.MapPath() to build your save path - user69820
As I said, the file should be being saved in the web site folder NOT where I am seeing in procmon that IIS is trying to save the file to. The vbscript code is being called by an asp page in a web site. Thanks - iss42

1 Answers

0
votes

Its trick to be sure without the presence of code in your question however I suspect that you are assuming that creating a file such as "ThisIsMyFile.txt" would create a file in the ASP application folder. It doesn't.

FileSystemObject knows nothing about IIS. It will use the application's current directory which defaults to he directory of the executable file used to start the process, which in the case of IIS is found in "C:\Windows\System32\inetsrv\".

What you need is this:-

Dim sFilePath : sFilePath = Server.MapPath("/") & "ThisIsMyFile.txt"

This creates a full path to a file that can be created in the web sites root folder.