VBScript/Classic ASP permission denied with fso.OpenTextFile after several uses -



VBScript/Classic ASP permission denied with fso.OpenTextFile after several uses -

i have process loops through moderate amount of info (1mb) storing in array , periodically writes disk. after several iterations, script fails @ fso.opentextfile() in else section though file has not been closed or finished closing previous time function called. iteration # doesn't seem specific it's happened anywhere between 2nd , 10th iteration can tell. file created , beingness appended doesn't appear permissions issue. considering adding time delay process don't want add together overhead long process.

os: windows 2012 r2

any thoughts or suggestions appreciated.

'write array disk sub writefile() 'on error resumenext set fso = server.createobject("scripting.filesystemobject") if needtocreatefile set objtextfile = fso.createtextfile(server.mappath("google/linklist.html"),true) objtextfile.writeline("<!doctype html>") objtextfile.writeline("<html>") objtextfile.writeline("<title>") objtextfile.writeline("content listing") objtextfile.writeline("</title>") needtocreatefile = false else ' opentextfile method needs const value ' forappending = 8 forreading = 1, forwriting = 2 set objtextfile = fso.opentextfile (filename, forappending, true) end if 'write contents of array file each link in linklist if link <>"" , not isnull(link) objtextfile.writeline(link & "<br>") end if next objtextfile.writeline("</html>") objtextfile.close set fso = nil set objtextfile = nil 'on error goto 0 end sub

follow - solved

adding 3 sec delay solved problem, delayed processing time. so, rather opening , closing file each time wanted write it, left open until entire script done , didn't need delay.

sub writefile() if needtocreatefile set objtextfile = fs.createtextfile(server.mappath("google/linklist.html"),true) objtextfile.writeline("<!doctype html>") objtextfile.writeline("<html>") objtextfile.writeline("<title>") objtextfile.writeline("content listing") objtextfile.writeline("</title>") needtocreatefile = false end if 'write contents of array file each link in linklist if link <>"" , not isnull(link) objtextfile.writeline(link & "<br>") end if next objtextfile.writeline("</html>") ' objtextfile.close ' set fso = nil ' set objtextfile = nil end sub

adding 3 sec delay solved problem, delayed processing time. so, rather opening , closing file each time wanted write it, left open until entire script done , didn't need delay. see modified script above.

vbscript

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -