Re: Deleting files with ASP

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Kevin Spencer (kevin_at_takempis.com)
Date: 03/08/04


Date: Mon, 8 Mar 2004 08:25:25 -0500

If that's the case, then it is entirely likely that the IUSER_<machine name>
has the wrong permissions with regards to that folder. It may have
permission to create new files, but not to overwrite or delete existing
files.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"JA" <jarmour@kc.rr.com> wrote in message
news:t1R2c.3512$4B1.1636@twister.rdc-kc.rr.com...
> I sent your posts to the programmer, he said:
>
> I have tried the second parameter a few days ago and it made no
difference.
> I got the same permission denied problem
>
>
> Thanks again, Jill
>
>
>
> "JA" <jarmour@kc.rr.com> wrote in message
> news:hCQ2c.3510$4B1.2158@twister.rdc-kc.rr.com...
> > Thanks, both of you, for your replies.
> >
> > Here is a smaller version of his logic that he made to show what is
> > happening. I don't know much about this, but it looks to me like this
> script
> > is trying to delete the file and then rewrite it. He (the programmer)
has
> > said that he has tried both overwriting and deleting. I can run this
once,
> > and the file will be created. If I run it again, I get this error:
> >
> > __________________________________
> >
> > Microsoft VBScript runtime error '800a0046'
> >
> > Permission denied
> >
> > /folder/testfiles.asp, line 10
> >
> > ___________________________________
> >
> > Only if I delete the file manually, I can run it again. Here is the
> script:
> >
> > ____________________________________
> >
> > <%Response.buffer=TRUE%>
> > <!-- #include file="st$db.asp"-->
> > <!-- #include file="fileio.asp"-->
> > <%
> > serverfilename="folder/filetest.txt"
> > Set objFS = CreateObject("Scripting.FileSystemObject")
> > serverfilename = Server.Mappath(serverfilename)
> > If objfs.FileExists(serverfilename) Then
> >    debugwrite "deleting " & serverfilename
> >    objfs.deletefile(serverfilename)
> > end if
> > Set objFile = objFS.CreateTextFile(serverfilename)
> > debugwrite "Creating " & serverfilename
> > objfile.WriteLine "This is a test line"
> > objfile.close
> > set objfs=nothing
> >
> > %>
> >
> > ___________________________________
> >
> > I'm going to send him what both of you wrote. If you see something else
> > wrong in the script, please let me know.
> >
> > Thank you!!
> >
> > Jill
> >
> >
> > "Jon" <js@roksteady.net> wrote in message
> > news:uhJ%23%23dKBEHA.1796@TK2MSFTNGP12.phx.gbl...
> > > > This depends somewhat on how you're creating the file.
> > > > For example, if you're using the
> > > > Scipting.FileSystemObject's CreateTextFile method, you
> > > > have to specify a second parameter such as
> > > >
> > > > fso.CreateTextFile("myfile.txt", true)
> > > >
> > > > if you want to overwrite any existing file. The default
> > > > for this method, is false, meaning that the
> > > > FileSystemObject won't overwrite existing files.
> > >
> > > Wrong way around - the default is to over-write unless you specify
> false.
> > > For example
> > > set f=oFso.createtextfile("c:\text.txt")
> > > the same as
> > > set f=oFso.createtextfile("c:\text.txt",true)
> > > would over-write text.txt if it existed. But
> > > set f=oFso.createtextfile("c:\text.txt",false)
> > > would give a "file exists" error if the file already exists.
> > >
> > > We would need to see the code (and the exact error message) to be able
> to
> > > help further.
> > >
> > > Jon
> > > Microsoft MVP - FP
> > >
> > > Jim Buyens wrote:
> > > >> -----Original Message-----
> > > >> Hi,
> > > >
> > > > Howdy.
> > > >
> > > >> I am using FP 2000 on IIS4/NT. I have an asp script that
> > > >> creates some files from a database. It writes from a
> > > >> private subfolder ( _folder)  to a subfolder of the
> > > >> private subfolder ( _folder/folder).
> > > >>
> > > >> It will work once, but once the files are in there, I
> > > >> can't run the script again  and overwrite them. I get
> > > >> a "permission denied" error. If I go in and manually
> > > >> delete the files, it will work again.
> > > >>
> > > >> Neither the programmer or my ISP can figure out what is
> > > >> wrong. The only other thing I can think of is a
> > > >> FrontPage quirk.
> > > >>
> > > >> Does anyone have any ideas on this?
> > > >> Thanks, Jill
> > > >
> > > > This depends somewhat on how you're creating the file.
> > > > For example, if you're using the
> > > > Scipting.FileSystemObject's CreateTextFile method, you
> > > > have to specify a second parameter such as
> > > >
> > > > fso.CreateTextFile("myfile.txt", true)
> > > >
> > > > if you want to overwrite any existing file. The default
> > > > for this method, is false, meaning that the
> > > > FileSystemObject won't overwrite existing files.
> > > >
> > > > For more information on Scripting.FileSystemObject
> > > > methods, browse:
> > > >
> > > > http://msdn.microsoft.com/library/en-us/script56/html/
> > > > fsooriScriptingRun-TimeReference.asp
> > > >
> > > > If this doesn't point to a solution, please post again to
> > > > this thread and include the exact block of code that's
> > > > failing.
> > > >
> > > > Jim Buyens
> > > > Microsoft FrontPage MVP
> > > > http://www.interlacken.com
> > > > Author of:
> > > > *----------------------------------------------------
> > > >> \---------------------------------------------------
> > > >>>     Microsoft Office FrontPage 2003 Inside Out
> > > >>> ---------------------------------------------------
> > > >>> Web Database Development Step by Step .NET Edition
> > > >>>    Microsoft FrontPage Version 2002 Inside Out
> > > >>>        Faster Smarter Beginning Programming
> > > >>>             (All from Microsoft Press)
> > > >> /---------------------------------------------------
> > > > *----------------------------------------------------
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: editing licensed shows
    ... You can do almost anything with CHESS if you get permission. ... the first productions done after Broadway was by the Long Beach Civic ... The script was very much changed by director ...
    (rec.arts.theatre.musicals)
  • RE: Help needed setting user security rights through a script
    ... 'this script will set permission on given folder... ... 'Folder on which permissions will be applied, ... 'users:C means "Users" group will be assigned Change permission. ... > install or uninstall applications. ...
    (microsoft.public.windows.server.scripting)
  • Re: User Account Security
    ... Better post this under the original posting, so that anybody could follow it and find it again. ... after some times about 30 minutes all permission changed with other ... I created a script and disabled this settings ... the password you add two deny ACE's to the DACL. ...
    (microsoft.public.windows.server.active_directory)
  • RE: Permission Denied 800A0046 GetObject
    ... Actually I got the script working via a text file containing the names of the ... For Each strComputer In arrComputers ... Set colIESettings = objWMIService.ExecQuery _ ... > and I get an error 800A0046 Permission Denied error on GetObject...now I get ...
    (microsoft.public.windows.server.scripting)
  • Re: Question for Script of users permission.
    ... BUT AS I AM USING THE SCRIPT ON THE MSDE FOR THE LOGIN ... AND PERMISSION OF USERS. ... >> As i have only one SQL server I have check the same on ...
    (microsoft.public.sqlserver.security)