Response.Write Strange Behaviour

Discussion in 'ASP General' started by Dominic Godin, May 25, 2004.

  1. 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
    Dominic Godin, May 25, 2004
    #1
    1. Advertising

  2. 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
    Dominic Godin, May 25, 2004
    #2
    1. Advertising

  3. Dominic Godin

    Ray at Guest

    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

    "Dominic Godin" <nospam@plz> wrote in message
    news:Xns94F49CAB58B62nospamplz@207.46.248.16...
    > 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
    >
    Ray at, May 25, 2004
    #3
  4. Maybe this will help?
    http://www.aspfaq.com/2498

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Dominic Godin" <nospam@plz> wrote in message
    news:Xns94F49B8672BD0nospamplz@207.46.248.16...
    > 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
    Aaron Bertrand - MVP, May 25, 2004
    #4
  5. 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.


    "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    news::

    > 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
    >
    > "Dominic Godin" <nospam@plz> wrote in message
    > news:Xns94F49CAB58B62nospamplz@207.46.248.16...
    >> 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
    >>

    >
    >
    Dominic Godin, May 25, 2004
    #5
  6. "Aaron Bertrand - MVP" <> wrote in news:#
    :

    >
    > Maybe this will help?
    > http://www.aspfaq.com/2498


    Thanks but it doesn't. I've chopped up the code with asp delimiters but it
    made no difference.

    Dominic Godin
    Dominic Godin, May 25, 2004
    #6
  7. Dominic Godin wrote:
    > 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
    Michael D. Kersey, May 25, 2004
    #7

  8. > 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
    > 74%40niu.edu&rnum=3&prev=/groups%3Fas_q%3D%26num%3D10%26as_scoring%

    3Dr%
    > 26hl%3Den%26ie%3DUTF-8%26btnG%3DGoogle%2BSearch%26as_epq%

    3Dresponse.isc
    > lientconnected%26as_oq%3D%26as_eq%3D%26as_ugroup%3D%26as_usubject%3D%

    26
    > as_uauthors%3D%26as_umsgid%3D%26lr%3D%26as_drrb%3Dq%26as_qdr%3D%

    26as_mi
    > nd%3D12%26as_minm%3D5%26as_miny%3D1981%26as_maxd%3D25%26as_maxm%3D5%

    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
    > tnG=Google+Search&as_epq=response.isclientconnected&as_oq=&as_eq=&as_u

    g
    > roup=&as_usubject=&as_uauthors=&as_umsgid=&lr=&as_drrb=q&as_qdr=&as_mi

    n
    > d=12&as_minm=5&as_miny=1981&as_maxd=25&as_maxm=5&as_maxy=2004

    &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.

    >
    > Good Luck,
    > Michael D. Kersey
    >
    Dominic Godin, May 25, 2004
    #8
  9. > I have set this to 30 minutes. The script only takes 10 so this is not
    > it :(.


    ???

    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.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/
    Aaron Bertrand - MVP, May 25, 2004
    #9
  10. :)

    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



    "Aaron Bertrand - MVP" <> wrote in
    news::

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

    >
    > ???
    >
    > 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.
    >
    Dominic Godin, May 25, 2004
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    2
    Views:
    7,993
    Charles A. Lackman
    Jan 11, 2006
  2. Matthew Wieder

    Response.Write and Response.Redirect

    Matthew Wieder, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    693
    Kevin Spencer
    Jul 17, 2003
  3. Sehboo
    Replies:
    3
    Views:
    8,795
    Sehboo
    Dec 10, 2003
  4. Replies:
    1
    Views:
    829
  5. slawekg

    Response.Write and Response.Redirect

    slawekg, Jun 21, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    379
    Alexey Smirnov
    Jun 21, 2007
Loading...

Share This Page