Reputation: 115
I have Classic ASP 2 websites on an Windows 2008 IIS 7 install. website1.com and website2.com. Both are serving the same website from one folder: C:\Webs\website\
website1.com has been in operation for 6 years and in the app it can write files to a network share; \wdc\SharedFiles\assets\docs\ All the proper permissions are set as it has been reading and writing files for years.
I recently added website2.com. The website is serving from the same diretory. I need it to be able to write to that same share. The problem is, website2.com gets "Write to file failed." and "Permission Denied" errors.
How is this possible?
I even mocked up a simple test. Same error.:
Dim fso, objFile
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set objFile=fso.CreateTextFile("\\wdc\SharedFiles\assets\docs\test.txt")
objFile.WriteLine("hello this is test")
objFile.Close
Set objFile=Nothing
Set fso=Nothing
Any ideas? I am pulling my hair out.
Upvotes: 2
Views: 5063
Reputation: 115
I figured this out on my own. So others can benefit, here it is:
Upvotes: 2
Reputation: 1044
Not sure if this will make a difference. The only difference in my code, really, is that I'm using server.mapPath to specify path.
path = Server.MapPath ("\")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(path & "\" & txtFileName, 2) '2 = for Writing
f.Write(txtFileContents)
f.close
set f=nothing
Upvotes: -1