Go Premium for a chance to win a PS4. Enter to Win


File System Object

Posted on 2000-05-16
Medium Priority
Last Modified: 2012-05-04
i am trying to create a filesystem object in my asp page in order to track the number of visit. However there are error which says:

Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object: 'Scripting.FileSystemObject'

may i know how to solve this problem??

thank you
Question by:riyugie
  • 4
  • 2
  • 2
  • +2

Expert Comment

ID: 2815696
Hi riyugie,

Post your code,and make sure there is Windows Scripting Host installed.

hope this helps

LVL 18

Expert Comment

ID: 2815788
Don't use components...;

<SCRIPT LANGUAGE="vbscript" RUNAT="server">
Function txtPageCounter
        Dim tmpHitCount,textObject,pagename,fhandle
        pagename = Request.ServerVariables("PATH_TRANSLATED") & ".txt"
        If Session(pagename) = "" Then
                Set textObject  = CreateObject("Scripting.FileSystemObject")
                If textObject.FileExists(pagename) Then

   Set fhandle = textObject.OpenTextFile(pagename)
   tmpHitCount = fhandle.readline
   tmpHitCount = 0
                End If
                tmpHitcount = tmpHitCount + 1
                Set fhandle = textObject.CreateTextFile(pagename)
                fhandle.writeline (tmpHitCount)
                Session(pagename) = tmpHitCount
                 tmpHitCount = Session(pagename)
        End If
        txtPageCounter = tmpHitCount

End Function

You are visitor # <%=txtPageCounter%>

Expert Comment

ID: 2820000
Change this line of code
Set textObject  = CreateObject("Scripting.FileSystemObject")
Set textObject  = Server.CreateObject("Scripting.FileSystemObject")

I faced similar problems with just using CreateObject, and the error was appearing at random.

By the way, if you still get the error, I would suggest, wrap your file handling code in a separate component and run it out of process.  You can do this by writing an ActiveX dll and registering with MTS as a server package. That's what I finally did to eliminate the error.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 18

Expert Comment

ID: 2820007

Author Comment

ID: 2823980
sgovinda ,

i have tried to use the server.createobject method, however, the error messages says that :"

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed


and i do not know how to create the dll, can u give me some ideas??

and here i accompany the codes that i have written:

      set fs = server.CreateObject("Scripting.FileSystemObject")
      varInOutFile = Server.MapPath("/home/home.cnt")
      set a = fs.openTextFile(varInOutFile)
      ct = cLng(a.ReadLine)

if ct <> session("VisitCount")  then
      Set fs = server.CreateObject("Scripting.FileSystemObject")
      varInOutFile = Server.MapPath ("/home/home.cnt")
      Set a = fs.OpenTextFile(varInOutFile)
      ct = CLng(a.ReadLine)
      ct = ct + 1
            Set a = fs.CreateTextFile(varInOutFile, True)
            a.WriteLine (ct)
      session("VisitCount") = ct
end if

LVL 18

Expert Comment

ID: 2823990
My code works perfectly without ANY modifications.  However you are free to make any changes you feel necessary, but it might break the code...

Accepted Solution

dstrommer earned 90 total points
ID: 2829629
Goto http://support.microsoft.com

Lookup Article ID: Q194801

The problem is that you don't have the dll installed, its corrupt, or you don't have permissions.

LVL 18

Expert Comment

ID: 2829792

Expert Comment

ID: 2830722
Microsoft has a great support database at http://support.microsoft.com.

The database contains technical articles about bugs, fixes, hints, tips, etc.

Each document begins with the letter Q.

The answer to your problem is found in the Article ID: Q194801

The problem is that you can't instantiate the COM component.

According to the Error you got and the Q document info.

You have 3 possible problems.

1. The COM (FileSystem COM object) is not installed.
2. The FileSystem COM object is corrupt.
3. You don't have permissions.

The Q document tells you how to fix the problems your having.

Author Comment

ID: 2831887
thank you all of u for the comments posted..

i have solved the problem and the problem is that the scrrun.dll file has been corrupted.

the error 'disappear' after i reinstall the IE5.

Thank you

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question