[thelist] File System Object not working on IIS

Ken Schaefer ken.schaefer at gmail.com
Thu Jul 29 22:26:33 CDT 2004


On Thu, 29 Jul 2004 21:46:43 -0500, Casey Crookston
<casey at thecrookstons.com> wrote:
> 
> > ----- Original Message -----
> > From: "Casey Crookston" <casey at thecrookstons.com>
> > Subject: [thelist] File System Object not working on IIS
> >
> >
> >  I used this little bit of code back when I was running PWS on win98.  It
> > used File System Objects to open and edit a text file.  I'm trying it now
> > on
> > winXP, IIS 5.1, and it hangs.  Not sure why....
> >
> > dim FileObj,OutStream
> >
> >  Set FileObj=Server.CreateObject("Scripting.FileSystemObject")
> >
> >  Set
> > OutStream=FileObj.OpenTextFile(Server.MapPath("includes/photo1.html"),2,
> >  TRUE)
> >
> >  OutStream.Write(Request.Form("strMessage"))
> >
> >  OutStream.Close
> >
> >  Response.Redirect"../default.asp"
> 
> Okay, now I'm getting this error:
> 
> Error Type:
> Microsoft VBScript runtime (0x800A0046)
> Permission denied
> /content_manage/text_edit/display_message.asp, line 67
> 
> Line 67 being:
> OutStream=FileObj.OpenTextFile(Server.MapPath("includes/photo1.html"),2,
> TRUE)
> 
> So, now I must admit that I don't know how to change the permissions on that
> file.  :-(
> 


Right-click on the file in Explorer -> Properties -> Security

If you are using Windows XP in a workgroup mode, disable Simple File
Sharing first (in Explorer goto Tools -> Folder Options -> View ->
Advanced -> uncheck "Use Simple File Sharing (Recommended)"

And you should:

Set FileObj = Nothing

before the redirect.

Cheers
Ken


More information about the thelist mailing list