Groups | Blog | Home
all groups > iis security > july 2004 >

iis security : FSO Object (Write Access Issues)


Brian
7/27/2004 5:53:49 PM
I have IIS 5.1 on Win XP Pro SP1. I'm trying to use ASP's
FSO Object to write to a file, but it never works.
Everytime I open the page, it just sits there, I wait and
wait, then it gives me an operation Timeout Message. I've
checked over the settings in IIS over and over again to
make sure I have write access, but for some reason it
just doesn't work.

Here is my ASP code
(C:\inetpub\wwwroot\lpctech\welcome.asp):
<%
'START OF CODE
Dim objFSO
Dim strPath
Dim intCount

strPath = Server.MapPath(strWritePath & "\hitCount.txt")
Set objFSO = Server.CreateObject
("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strPath, ForReading,
True, TristateFalse)
intCount = int(objFile.ReadLine)
objFile.Close
intCount = intCount + 1
Set objFile = objFSO.OpenTextFile(strPath, ForWriting,
True, TristateFalse)
objFile.Write intCount
objFile.Close
'END OF CODE
%>

Explaination: What I'm trying to do here is a simple file
based hit counter.

strWritePath is a string set in include.asp which is
included in the file.

Here is what it is in there:
strWritePath = Server.MapPath(.\db)

Which translates to:
C:\Inetpub\wwwroot\lpctech\db

What the code does is open a file (hitcount.txt) which
just has a number. It reads that number, converts it into
an interger, increments it, and writes it back into the
file.

I've tested this script on my website (hosted by someone
else) and it works without a problem. It has a problem
with my computer.

If you have any idea what's wrong, please tell me.
email: lord03000@hotmail.com
Brian
7/27/2004 7:10:05 PM
Thanks Ken for your input.

I'll look into this, but I do use the same computer for
this. Thus if NAV stopped it, I would see an dialogue.

[quoted text, click to view]
Paul Lynch
7/28/2004 9:12:27 AM
On Tue, 27 Jul 2004 17:53:49 -0700, "Brian" <lord03000@hotmail.com>
[quoted text, click to view]

Hi,

This could either be due to insufficient permissions on the target
directory or possibly because you have some AV software installed
which may be blocking FSO access.

http://www.aspfaq.com/show.asp?id=2180


Regards,

Paul Lynch
Ken Schaefer
7/28/2004 11:07:26 AM
Check your Antivirus Software. Most AV software these days includes features
to prevent the FSO from writing files (because a lot of viruses use the FSO
to write stuff). You'll need to disable that feature. What usually happens
is that a dialogue box pops up asking if you want to allow the FSO to write
to the disk, however because the user account that is running the webpage
isn't the same as the one you're logged in as, you never see the dialogue
box, and the page appears to "hang" (it's waiting for someone to click
"OK").

In Norton Antivirus, the feature is called "script blocking"

Cheers
Ken

[quoted text, click to view]

Ken Schaefer
7/28/2004 12:43:54 PM
No, you would not see a dialogue. You are not understanding. Windows XP is a
multi-user operating system. Each user has their own security context,
including their own desktop. Now, you are logged into the machine as
"Brian". However IIS is impersonating "IUSR_<machinename>" by default, so
the dialogue box would pop-up on IUSR_<machinename>'s desktop, not your
desktop. You can't see dialogue boxes on the desktop of a different user.

This isn't exactly how it works, but it's a good enough explanantion of
what's happening. Basically the webpage is being run in a different user
context to yours. And the dialogue box, if it popped up, would pop-up on the
desktop of that other user context.

Cheers
Ken

[quoted text, click to view]

AddThis Social Bookmark Button