Solved

Error trying to use Server.CreateObject("Scripting.FileSystemObject") to browse local system

Posted on 2006-10-30
14
851 Views
Last Modified: 2008-01-09
I have a windows XP SP 2 system and I am trying to use the following code to browse documents in a specified folder on my system.

I get this error message


Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string


The code is

<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 ID="Table3" width=100%>
<TR BGCOLOR="#000000">
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Form</B></FONT></TD>
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Filename:</B></FONT></TD>
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Size:</B></FONT></TD>
      <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>File type:</B></FONT></TD>
      <TD class=inputbox><FONT COLOR="#FFFFFF"><B>Date created:</B></FONT></TD>
<%
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder(Server.MapPath("../forms"))
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<TR BGCOLOR="#F7F7E7">
      <TD  class=inputbox><img src="../forms/<%=thing.Name%>" width=50></TD>
      <TD  class=inputbox><A HREF="../forms/<%=thing.Name%>"><%=thing.Name%></A></TD>
      <TD ALIGN=RIGHT><%=thing.Size%>bytes</TD>
      <TD  class=inputbox><%=thing.Type%></TD>
      <TD><%=thing.DateCreated%></TD>
<%
NEXT
%>
</TABLE>

Very Important to get the asnwer ASAP

Thanks in advance.
0
Comment
Question by:souldj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 17837719
What line is throwing the error?

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 17837736
For troubleshooting, let's try this:

<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 ID="Table3" width=100%>
<TR BGCOLOR="#000000">
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Form</B></FONT></TD>
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Filename:</B></FONT></TD>
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>Size:</B></FONT></TD>
     <TD  class=inputbox><FONT COLOR="#FFFFFF"><B>File type:</B></FONT></TD>
     <TD class=inputbox><FONT COLOR="#FFFFFF"><B>Date created:</B></FONT></TD>
<%
' Create an instance of the FileSystemObject
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
If IsObject(MyFileObject) Then
      response.write "MyFileObjectCreated"
Else
      response.write "Could not create object"
End If
response.end
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder(Server.MapPath("../forms"))
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
%>
<TR BGCOLOR="#F7F7E7">
     <TD  class=inputbox><img src="../forms/<%=thing.Name%>" width=50></TD>
     <TD  class=inputbox><A HREF="../forms/<%=thing.Name%>"><%=thing.Name%></A></TD>
     <TD ALIGN=RIGHT><%=thing.Size%>bytes</TD>
     <TD  class=inputbox><%=thing.Type%></TD>
     <TD><%=thing.DateCreated%></TD>
<%
NEXT
%>
0
 
LVL 1

Author Comment

by:souldj
ID: 17837819
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")

This is the line giving the error.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 17837892
Take a look at the last post in this thread:

http://www.thescripts.com/forum/thread460883.html

FtB
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 17837893
Hi,

Invalid class string means the DLL that your trying to reference is not registered on the machine. You will need to download the scripting dll from Microsoft. It is called scrrun.dll. It may be on your installation media.

Regards,

Lee
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 17837955
Lee--

Sometimes that is the case, but other times it appears that inadequate permission settings results in the same error message.

FtB
0
 
LVL 1

Author Comment

by:souldj
ID: 17839857
Based on the URL provided by fritz_the_blank, I got


1) Logged onto the machine as an administrator, without the network being
connected.

2) Start > Run > regedit

3) HKEY_LOCAL_Machine > SOFTWARE > Classes > Scripting.FileSystemObject

4) Right Click and select Permissions.
If yours is like mine, there will be only one or two there.
Add the permissions for all the normal users - System, IUSR_..., Guests,
Administrator

5) HKEY_LOCAL_Machine > SOFTWARE > Classes > CLSID
Search for this {0D43FE01-F093-11CF-8940-00A0C9054228}
Add the same permissions that you added to #4

6) Save the registry

7) Reboot, cross your fingers and anything else that will cross (it worked
for me anyway)

8) Test your FSO program again, mine worked, I hope yours does as well.




I searched for the registry itme  HKEY_LOCAL_Machine > SOFTWARE > Classes > Scripting.FileSystemObject but when I got it , it had no values and allowed me to add no values to it.

What next? Is it time to ReInstall?
0
 
LVL 12

Expert Comment

by:sandip132
ID: 17839924
you need to adjust the permissions on the SCRRUN.DLL.
Here's how you do it:
Navigate to your WINNT\SYSTEM32 directory and find the SCRRUN.DLL. Right-click the file and select properties. Then click the security tab and ensure that the IUSR_<machinename> and IWAM_<machinename> accounts have "read" and "read & execute" permissions. That's it.
0
 
LVL 1

Author Comment

by:souldj
ID: 17840535
My machine name is Blueice and so I have added the users IUSR_blueice and IWAM_blueice to the permissions on the file SCRRUN.DLL and still getting the same error message
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 17843244
Things are looking grim.

What if you create a .vbs file and run it on the machine when you are logged in as an administrator? If that works, then you know that the .dll is present, registered, and functioning. Moreover, that will point to a permissions error. If, on the other hand, that does not work, then that permissions are not the issue.

FtB

0
 
LVL 1

Author Comment

by:souldj
ID: 17843669
Can you give me a simple vbs file to run on my system? or recommend the code for one as I have never written one before
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 17843788
Paste the following into a text file and save it with a .vbs extention and then double click the file to execute it:

' Create an instance of the FileSystemObject
Set MyFileObject=CreateObject("Scripting.FileSystemObject")
' Create Folder Object
Set MyFolder=MyFileObject.GetFolder("C:\YourDirectoryGoesHere")
'Loop trough the files in the folder
FOR EACH thing in MyFolder.Files
      msgBox thing.Name
NEXT
0
 
LVL 1

Author Comment

by:souldj
ID: 17843822
Error was encountered.

Line 4 Char 1
Active X component can't create object "Scripting.FileSystemObject
Code: 800A01AD
Microsoft VDScript runtine Error


What now?
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 500 total points
ID: 17843930
It seems that there may be something wrong with the .dll as Lee suggested. This might help:


http://support.microsoft.com/default.aspx/kb/194801
0

Featured Post

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!

Question has a verified solution.

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

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

626 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