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

x
?
Solved

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

Posted on 2006-10-30
14
Medium Priority
?
858 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
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 1000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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 Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
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