IIS Server Security - FSO Object (Write Access Issues)

This is Interesting: Free IT Magazines  
Home > Archive > IIS Server Security > July 2004 > FSO Object (Write Access Issues)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author FSO Object (Write Access Issues)
Brian

2004-07-27, 8:55 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
Thanks in advance for any help.
Ken Schaefer

2004-07-27, 8:55 pm

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

"Brian" <lord03000@hotmail.com> wrote in message
news:557001c4743d$58803200$a601280a@phx.gbl...
> 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
> Thanks in advance for any help.



Brian

2004-07-27, 8:55 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.

>-----Original Message-----
>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
>
>"Brian" <lord03000@hotmail.com> wrote in message
>news:557001c4743d$58803200$a601280a@phx.gbl...
ASP's[vbcol=seagreen]
and[vbcol=seagreen]
I've[vbcol=seagreen]
& "\hitCount.txt")[vbcol=seagreen]
file[vbcol=seagreen]
into[vbcol=seagreen]
someone[vbcol=seagreen]
>
>
>.
>

Ken Schaefer

2004-07-27, 8:55 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

"Brian" <lord03000@hotmail.com> wrote in message
news:566b01c47447$ffb860b0$a401280a@phx.gbl...[vbcol=seagreen]
> 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.
>
> days includes features
> viruses use the FSO
> What usually happens
> allow the FSO to write
> running the webpage
> see the dialogue
> someone to click
> blocking"
> ASP's
> and
> I've
> & "\hitCount.txt")
> file
> into
> someone


Paul Lynch

2004-07-28, 2:59 am

On Tue, 27 Jul 2004 17:53:49 -0700, "Brian" <lord03000@hotmail.com>
wrote:

>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
>Thanks in advance for any help.


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
MCSE
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com