Error while writing to a text file

Results 1 to 3 of 3

Thread: Error while writing to a text file

  1. #1
    John De Britto Guest

    Default Error while writing to a text file

    The following error is coming while writing to the text file.<BR>Please help me to correct this.<BR><BR>Microsoft VBScript runtime error &#039 800a0046&#039 <BR><BR>Permission denied <BR><BR>/new/count.asp, line 10 <BR><BR>**************************************<BR> This is the code.<BR>&#060;%<BR>Dim ct<BR>set fso=CreateObject("Scripting.FileSystemObject")<BR> set wso=fso.OpenTextFile(Server.MapPath("count1.txt"), 1,create)<BR>ct=Clng(wso.ReadLine)<BR>if Session("ct")="" Then<BR>session("ct")=ct<BR>ct=ct+1<BR>wso.close<B R>set wso=fso.CreateTextFile(Server.MapPath("count1.txt" ),True,False)<BR>wso.WriteLine(ct)<BR>End IF<BR>wso.Close<BR>Response.write ct<BR>%&#062;

  2. #2
    lagerBoy Guest

    Default Not sure but maybe...

    I haven&#039t used the FileSystemObject much before so I&#039m not sure if this will be of any assistance to you or not, but on your line:<BR><BR>set wso=fso.OpenTextFile(Server.MapPath("count1.txt"), 1,create)<BR><BR>I believe that the 1 means open the file for Reading and 2 would indicate for writing. So maybe you should have:<BR><BR>set wso=fso.OpenTextFile(Server.MapPath("count1.txt"), 2,create)<BR><BR>Be interested to hear if this helps.<BR><BR><BR><BR>

  3. #3
    John De Britto Guest

    Default RE: Not sure but maybe...

    For writing to the database, I think we have to use the physical path like "E:inetpubwwwrootsomenamecount.txt" instead of virtual path.<BR><BR>Or this configuring the Internet Service Manager to "Allow Anonymous Access". <BR><BR>I got this options now only..

Posting Permissions

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