Solved

File System Object

Posted on 2000-05-16
10
952 Views
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
0
Comment
Question by:riyugie
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 6

Expert Comment

by:setiawan
ID: 2815696
Hi riyugie,

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

hope this helps

  danny
0
 
LVL 18

Expert Comment

by:mgfranz
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
                Application.Lock
                Set textObject  = CreateObject("Scripting.FileSystemObject")
                If textObject.FileExists(pagename) Then

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

End Function
</SCRIPT>
....

You are visitor # <%=txtPageCounter%>
0
 
LVL 1

Expert Comment

by:sgovinda
ID: 2820000
Change this line of code
Set textObject  = CreateObject("Scripting.FileSystemObject")
to
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.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 18

Expert Comment

by:mgfranz
ID: 2820007
???
0
 

Author Comment

by:riyugie
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)
      a.close

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
            a.Close
            Set a = fs.CreateTextFile(varInOutFile, True)
            a.WriteLine (ct)
      a.Close
      session("VisitCount") = ct
end if

0
 
LVL 18

Expert Comment

by:mgfranz
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...
0
 

Accepted Solution

by:
dstrommer earned 30 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.

0
 
LVL 18

Expert Comment

by:mgfranz
ID: 2829792
What???
0
 

Expert Comment

by:dstrommer
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.
0
 

Author Comment

by:riyugie
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
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

808 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