473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Write file from asp page.

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"
%>


May 11 '06 #1
5 4806
"MichaelK" <mi******@gomobile.com> wrote in message
news:#p**************@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?


Try changing

set oTextFile = oFs.OpenTextFile(FileName, iMode, True)

to

set oTextFile = oFs.OpenTextFile(Server.MapPath(FileName), iMode, True)
May 11 '06 #2
Dan
If you have Antivirus installed on your server, make sure you set the proper
option.
Antivirus can prevent fso script to work too.

"MichaelK" <mi******@gomobile.com> wrote in message
news:%2****************@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"
%>

May 11 '06 #3
"MichaelK" <mi******@gomobile.com> wrote in message
news:#p**************@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?


Remove or comment out the line:
on error resume next
and see what error message you get.
May 11 '06 #4
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.
May 11 '06 #5
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

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O6**************@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.

May 11 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jajoo | last post by:
Hi everyone, I am trying to send files with multipart/form-date. Everything is ok with the send. But when I am receiving the files I should specify a directory where the files to be saved. The...
1
by: DC Gringo | last post by:
I have some code that writes log entries upon errors in an VB.NET web app. I can write the Message but in the log, preceding my message is the following: Description: The description for...
1
by: David Arden Stevensonn | last post by:
Say I have an XML file on my website that gets read alot (by a c# aspx page) but written to occasionally (also by the same c# aspx page) . Its a simple caching situation based on time. Example: If...
0
by: Peter Horwood | last post by:
I am having trouble writing an XML file out on my localhost development machine. I get: Server Error in '/ProblemSolved' Application. -----------------------------------------------------------...
0
by: Bennett Haselton | last post by:
I've noticed that if you enter the following code in the codebehind page for an .aspx page, it won't compile because the call to Trace.Write() is not valid except in methods of a class derived from...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
1
by: Gregory Gadow | last post by:
I have a folder on \\webserver\wwwroot, called staticContent. The folder has several message of the day text files, such as RepMotd.text. I have an admin page, AdminMotd.aspx, that allows a user to...
24
by: Bill | last post by:
Hello, I'm trying to output buffer content to a file. I either get an access violation error, or crazy looking output in the file depending on which method I use to write the file. Can anyone...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.