|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Write file from asp page.
I'm using the code below. By some reason it just hanging on and not doing anything. Just the progress bar is moving very very slow and maximum gets to the middle. Tryed it on two different server, same result. I have feeling I used to run this before with Server.MapPath and without, and it worked. But not now. Can somebody tell what's wrong with it? Thanks, Michael Here is the code: <% sub WriteToFile(FileName, Contents, Append) on error resume next Dim oFs, oTextFile, iMode if Append = true then iMode = 8 else iMode = 2 end if set oFs = server.createobject("Scripting.FileSystemObject") set oTextFile = oFs.OpenTextFile(FileName, iMode, True) oTextFile.Write Contents oTextFile.Close set oTextFile = nothing set oFS = nothing end sub WriteToFile "zzz.txt", "XXXXXXXXXXXXXXXXX", true response.write "Recorded" %>
Show quote
"MichaelK" <micha***@gomobile.com> wrote in message Try changingnews:#psFJ$IdGHA.3900@TK2MSFTNGP05.phx.gbl... > I need to write a log file on server side. > I'm using the code below. By some reason it just hanging on and not doing > anything. > Just the progress bar is moving very very slow and maximum gets to the > middle. > Tryed it on two different server, same result. > I have feeling I used to run this before with Server.MapPath and without, > and it worked. > But not now. > > Can somebody tell what's wrong with it? > set oTextFile = oFs.OpenTextFile(FileName, iMode, True) to set oTextFile = oFs.OpenTextFile(Server.MapPath(FileName), iMode, True) If you have Antivirus installed on your server, make sure you set the proper
option. Antivirus can prevent fso script to work too. Show quote "MichaelK" <micha***@gomobile.com> wrote in message news:%23psFJ$IdGHA.3900@TK2MSFTNGP05.phx.gbl... >I need to write a log file on server side. > I'm using the code below. By some reason it just hanging on and not doing > anything. > Just the progress bar is moving very very slow and maximum gets to the > middle. > Tryed it on two different server, same result. > I have feeling I used to run this before with Server.MapPath and without, > and it worked. > But not now. > > Can somebody tell what's wrong with it? > Thanks, > Michael > > Here is the code: > > <% > sub WriteToFile(FileName, Contents, Append) > on error resume next > Dim oFs, oTextFile, iMode > if Append = true then > iMode = 8 > else > iMode = 2 > end if > set oFs = server.createobject("Scripting.FileSystemObject") > set oTextFile = oFs.OpenTextFile(FileName, iMode, True) > oTextFile.Write Contents > oTextFile.Close > set oTextFile = nothing > set oFS = nothing > > end sub > > WriteToFile "zzz.txt", "XXXXXXXXXXXXXXXXX", true > > response.write "Recorded" > %> > > > > "MichaelK" <micha***@gomobile.com> wrote in message Remove or comment out the line:news:#psFJ$IdGHA.3900@TK2MSFTNGP05.phx.gbl... > I need to write a log file on server side. > I'm using the code below. By some reason it just hanging on and not doing > anything. > Just the progress bar is moving very very slow and maximum gets to the > middle. > Tryed it on two different server, same result. > I have feeling I used to run this before with Server.MapPath and without, > and it worked. > But not now. > > Can somebody tell what's wrong with it? on error resume next and see what error message you get. MichaelK wrote:
> I need to write a log file on server side. http://www.aspfaq.com/show.asp?id=2180> I'm using the code below. By some reason it just hanging on and not > doing anything. -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup. Thanks guys.
Yes I had the script blocking enabled in Norton Antivirus. And on one server it works fine now with both MapPath and without. On another still hanging on. Commented on error. Got "The maximum amount of time for a script to execute was exceeded", but it's not a reason (90 sec would be more then enough). May be something in IIS configuration not letting me? I enabled Write option on the Home Directory tab in Website properties, didn't help. Besides the working one has this disabled. Any other ideas? Regards, Michael Show quote "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message news:O6BYD4OdGHA.4576@TK2MSFTNGP05.phx.gbl... > MichaelK wrote: >> I need to write a log file on server side. >> I'm using the code below. By some reason it just hanging on and not >> doing anything. > > http://www.aspfaq.com/show.asp?id=2180 > > -- > Microsoft MVP -- ASP/ASP.NET > Please reply to the newsgroup. The email account listed in my From > header is my spam trap, so I don't check it very often. You will get a > quicker response by posting to the newsgroup. > > |
|||||||||||||||||||||||