Response.Write Strange Behaviour

D

Dominic Godin

Hi,

I have an asp page that does a lot of processing and reports it's
finished by printing the word "Success". For example:

<% SomeFunction(SomeVar)

SomeFunction(SomeVar1)

SomeFunction(SomeVar3)

Response.Write("Success")

%>

For one of our clients the word "Success" no longer appears. The page
is stuck loading. I have checked the log files created by the
processing function and they all complete their tasks successfully.
Even stranger still if I add some debugging code to the function:-

<% Function SomeFunction (SomeVar)

For i = 0 to ABigNumber

...Do some stuff...

Response.Write ("Some debug text")
Response.Flush

Next
End Function %>

This will print out all the debugging text and the wanted word
"Success". I tab the two Response lines out and the page never loads.
Put then back in and the page prints all the text and loads fine.

It seems that if you don't keep the response object busy it will stop
working after a few minutes. I have tried Response.End, Response.Flush
even Response.WriteBlock and still nothing.

I am trying to find a way to print out the word "Success" with all the
debug text. Any ideas?

Dominic Godin
 
D

Dominic Godin

Opps Should be:-

I am trying to find a way to print out the word "Success" WITHOUT all the
debug text. Any ideas?


Makes all the difference :)

Dominic Godin
 
R

Ray at

Well, as soon as you response.Flush your response, that text will be out.
You can comment out the response.flush lines and then do a Response.Clear
just before you do your Response.WRite "success".

Ray at work
 
D

Dominic Godin

Hi,

Unfortunately this doesn't work.

Originally the asp page ended with:


Response.Write "Success"
%>

Which still works for most of our clients.

For the long proccessing time case I have tried:

Response.Clear
Response.Write "Success"
Response.Flush
%>

<%
Response.End
%>


and many combinations of the above.
I have also tried:


<% SomeFunction(SomeVar)
Response.Write("Test1") %>

<% Response.Flush %>

<% SomeFunction(SomeVar1)
Response.Write("Test2") %>

<% Response.Flush %>

<% SomeFunction(SomeVar3)

......

Response.Write("Success")

%>

With the two Response lines commented out it still loads forever. I know
the functions have run due to the changes they make to our log files. It's
just the Response.Write that doesn't do anything.
 
M

Michael D. Kersey

Dominic said:
Hi,

I have an asp page that does a lot of processing and reports it's
finished by printing the word "Success". For example:

<% SomeFunction(SomeVar)

SomeFunction(SomeVar1)

SomeFunction(SomeVar3)

Response.Write("Success")

%>

For one of our clients the word "Success" no longer appears. The page
is stuck loading. I have checked the log files created by the
processing function and they all complete their tasks successfully.
Even stranger still if I add some debugging code to the function:-

<% Function SomeFunction (SomeVar)

For i = 0 to ABigNumber

...Do some stuff...

Response.Write ("Some debug text")
Response.Flush

Next
End Function %>

This will print out all the debugging text and the wanted word
"Success". I tab the two Response lines out and the page never loads.
Put then back in and the page prints all the text and loads fine.

It seems that if you don't keep the response object busy it will stop
working after a few minutes. I have tried Response.End, Response.Flush
even Response.WriteBlock and still nothing.

I am trying to find a way to print out the word "Success" with all the
debug text. Any ideas?

Dominic Godin

First off, do a "View Source" in the browser and _ensure_ that the
"Success" isn't present in the HTML page's source; incorrect HTML can
render it not visible.

Long-running pages can timeout: see the Server.ScriptTimeout property,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_vbom_seropsct.asp
which is set in seconds. Default value is 90 seconds IIRC but cannot be
set to less than the value in IIS configuration(metabase).

Also look at the Response.IsClientConnected property. There's a good
post on it by Manohar Kamath at
http://www.google.com/groups?hl=en&...as_maxd=25&as_maxm=5&as_maxy=2004&safe=images

Still more posts at
http://www.google.com/groups?as_q=&...as_maxd=25&as_maxm=5&as_maxy=2004&safe=images

and some WWW documentation at
http://www.google.com/search?q=+"re...ted"&hl=en&lr=&ie=UTF-8&sa=N&scoring=r&tab=gw

Good Luck,
Michael D. Kersey
 
D

Dominic Godin

First off, do a "View Source" in the browser and _ensure_ that the
"Success" isn't present in the HTML page's source; incorrect HTML can
render it not visible.

Checked and it isn't :(.
Long-running pages can timeout: see the Server.ScriptTimeout property,
http://msdn.microsoft.com/library/default.asp?url=/library/en- us/iissdk
/iis/ref_vbom_seropsct.asp which is set in seconds. Default value is
90 seconds IIRC but cannot be set to less than the value in IIS
configuration(metabase).

I have set this to 30 minutes. The script only takes 10 so this is not
it :(.

Also look at the Response.IsClientConnected property. There's a good
post on it by Manohar Kamath at
http://www.google.com/groups?hl=en&lr=&ie=UTF-8&threadm= 35002A69.4C56D0
26
26a
s_maxy%3D2004%26safe%3Dimages

Still more posts at
http://www.google.com/groups?as_q=&num=10&as_scoring=r&hl=en&ie=UTF-8 &b
g
n
&safe=imag
es

and some WWW documentation at
http://www.google.com/search?q=+"response.isclientconnected" &hl=en&
lr=&ie=UTF-8&sa=N&scoring=r&tab=gw

I tried adding

'Check to see if the client is connected.
If Not Response.IsClientConnected Then
'Get the sessionid to send to the shutdown function.
Shutdownid = Session.SessionID
'Perform shutdown processing.
Shutdown(Shutdownid)
End If

This doesn't work. I'm sure this just stops it running server side.
 
A

Aaron Bertrand - MVP

I have set this to 30 minutes. The script only takes 10 so this is not

???

You have an ASP script that takes 10 minutes? Have you considered a
different approach? This is not a realistic time frame for a web page,
IMHO. An end user is not going to wait for it. If it's a task for admins
only, there are probably a dozen other approaches, depending on what exactly
you are trying to accomplish.
 
D

Dominic Godin

:)

OK let me explain.

We have a software product that our clients use. They have the option
to upload certain data to an online database for display on the web.
The application to upload this data originally connected directly to the
online database at the clients ISP. We gave up this approach as many
ISPs seemed unable or unwilling to let us connect through their
firewalls.

The new approach was to ftp the data in delimited text files to the ISP
and run a asp script to import them from behind the firewall. This is
this script I'm having trouble with. It imports the data and displays
"Success" which the application uses to check if the import was
successful. We have been using this for over a year now without any
trouble.

I didn't write or design this but I have the unfortunate task of
maintaining it. One of our clients uploads a lot of data and this is
the one causing me problems.

As I'm running out of time to fix this I have used a botch.

I now Response.Write( "&nbsp;" ) in the importing function loop to keep
the Response working.

The application then just trims the output.

Not pretty but it's a solution and I'm just about out of time. I wish I
could do this properly but I just don't know how.

Dominic Godin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top