FileSystemObject problem

Results 1 to 2 of 2

Thread: FileSystemObject problem

  1. #1
    Join Date
    Dec 1969

    Default FileSystemObject problem

    Hi all,<BR><BR>I&#039;m using the FSO object to create a vCalendar file. I fill out a form with some information, and this is written to the text file. When the script is run, I&#039;ve set the overwrite flag to true so that whenever the script is run, it always overwrites the file.<BR><BR>Now, this file is very small. Not even half of 1k, yet to overwrite the existing file takes between 30 seconds and 3 minutes!<BR><BR>Are there any known issues with FSO or something that I&#039;m missing? Apologies since it&#039;s in Jscript, but I felt this might be a known issue rather than a specific coding problem since the script does in fact, work. Here&#039;s the code:<BR><BR>// check form submission<BR><BR>if (String(Request.QueryString("submit")) != "undefined") {<BR><BR>// create the fso object and create the .vcs file<BR><BR>&nbsp;&nbsp;var fso = Server.CreateObject("Scripting.FileSystemObject"); <BR>&nbsp;&nbsp;var newFile = fso.CreateTextFile(Server.MapPath("newcal.vcs"),tr ue);<BR><BR>// write contents to the file<BR><BR>&nbsp;&nbsp;newFile.WriteLine("BEGIN:V CALENDAR");<BR>&nbsp;&nbsp;newFile.WriteLine("PROD ID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN");<BR>&nbsp;&nbsp;newFile.WriteLine("VERSION:1. 0");<BR>&nbsp;&nbsp;newFile.WriteLine("BEGIN:VEVEN T");<BR>&nbsp;&nbsp;newFile.WriteLine("DTSTART:200 11212T110000Z");<BR>&nbsp;&nbsp;newFile.WriteLine( "DTEND:20021211T203000Z");<BR>&nbsp;&nbsp;newFile. WriteLine("LOCATION;ENCODING=QUOTED-PRINTABLE:" + Request.Form("location"));<BR>&nbsp;&nbsp;newFile. WriteLine("TRANSP:2");<BR>&nbsp;&nbsp;newFile.Writ eLine("UID:040000008200E00074C5B7101A82E0080000000 0A0B052026F7DC1010000000000000000100");<BR>&nbsp;& nbsp;newFile.WriteLine(" 0000029A1720F8CEB2F47A0814601DC37D006");<BR>&nbsp; &nbsp;newFile.WriteLine("DESCRIPTION;ENCODING=QUOT ED-PRINTABLE:" + Request.Form("description"));<BR>&nbsp;&nbsp;newFi le.WriteLine("SUMMARY;ENCODING=QUOTED-PRINTABLE:" + Request.Form("subject"));<BR>&nbsp;&nbsp;newFile.W riteLine("PRIORITY:"+Request.Form("priority"));<BR >&nbsp;&nbsp;newFile.WriteLine("END:VEVENT");<BR>& nbsp;&nbsp;newFile.WriteLine("END:VCALENDAR");<BR> <BR>// close the file<BR><BR>&nbsp;&nbsp;newFile.Close();<BR><BR>// clean up<BR><BR>&nbsp;&nbsp;newFile = null;<BR>&nbsp;&nbsp;fso = null;<BR><BR>// redirect to the new file<BR><BR>&nbsp;&nbsp;Response.Redirect("newcal. vcs");<BR><BR>}<BR><BR>Has anyone got any suggestions?<BR><BR>Thanks in advance,<BR><BR>hellz.<BR><BR>P.S. Indenting 0wnz hehe

  2. #2
    Join Date
    Dec 1969

    Default RE: FileSystemObject problem

    I wonder if it would make any difference if you concatenated one long string, inserting
    at your line breaks, and then wrote it to the file using a single newFile.Write?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts