Alternative to Response.Redirect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Colin Steadman

    Alternative to Response.Redirect

    I'm looping through an array of employee numbers and
    sending them to an Oracle procedure for processing. While
    I'm doing this I'm updating a <DIV> tag in the browser
    with index number of the current array item so the user
    knows how far along in processing we are. The ASP looks
    something like this:

    <div id=messageToUse rTxT>Please wait...</div>

    <%
    For i = LBound(arrayOfE mployeeNumbers) To _
    UBound(arrayOfE mployeeNumbers)

    '...Generate and execute SQL
    cn.execute SQL

    %>
    <script language=javasc ript>
    document.getEle mentById('messa geToUserTxT').i nnerText
    = 'Processing <%=i%> of <%=UBound(array OfEmployeeNumbe rs)%[color=blue]
    >';[/color]
    </script>
    <%
    Response.flush( )
    Next
    %>

    This does exactly what I want it to do, but I now get this
    error when I try and redirect the user to another page
    when the processing is complete:


    The HTTP headers are already written to the client
    browser. Any HTTP header modifications must be made
    before writing page content


    According to some posts I've seen in the forum this
    happens because I've already written some HTML to the
    browser.

    I was wondering therefore if there is any way I could
    redirect the user to the next page using some other
    mechanism? I seem to recall an alternative to using
    Response.Redire ct, but I cant remember what it is!

    Any ideas?

    Thanks,

    Colin


  • Ray Costanzo [MVP]

    #2
    Re: Alternative to Response.Redire ct

    You'd have to use a client-side "alternativ e" such as:

    location.href=' someotherpage.a sp';

    Ray at work


    "Colin Steadman" <anonymous@disc ussions.microso ft.com> wrote in message
    news:708101c4cb e5$febd61b0$a30 1280a@phx.gbl.. .[color=blue]
    >
    > I was wondering therefore if there is any way I could
    > redirect the user to the next page using some other
    > mechanism? I seem to recall an alternative to using
    > Response.Redire ct, but I cant remember what it is![/color]


    Comment

    • Evertjan.

      #3
      Re: Alternative to Response.Redire ct

      Ray Costanzo [MVP] wrote on 16 nov 2004 in
      microsoft.publi c.inetserver.as p.general:
      [color=blue]
      > "Colin Steadman" <anonymous@disc ussions.microso ft.com> wrote in message
      > news:708101c4cb e5$febd61b0$a30 1280a@phx.gbl.. .[color=green]
      >>
      >> I was wondering therefore if there is any way I could
      >> redirect the user to the next page using some other
      >> mechanism? I seem to recall an alternative to using
      >> Response.Redire ct, but I cant remember what it is![/color]
      >
      > You'd have to use a client-side "alternativ e" such as:
      >
      > location.href=' someotherpage.a sp';[/color]

      Strange as it seems

      Response.redire ct 'someotherpage. asp'

      is in fact a clientside action.
      Only a browser understanding the header directive,
      will execute that code and redirect.
      However

      Server.transfer 'someotherpage. asp'

      is strictly serverside.

      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress,
      but let us keep the discussions in the newsgroup)

      Comment

      • Colin Steadman

        #4
        Re: Alternative to Response.Redire ct

        >-----Original Message-----[color=blue]
        >You'd have to use a client-side "alternativ e" such as:
        >
        >location.href= 'someotherpage. asp';
        >
        >Ray at work
        >[/color]


        OK, thankyou Ray.

        Colin

        Comment

        • Guest's Avatar

          #5
          Re: Alternative to Response.Redire ct

          >[color=blue]
          >Server.transfe r 'someotherpage. asp'
          >
          >is strictly serverside.
          >[/color]


          Aha! Thats what I was looking for.

          However I've since incorporated 'someotherpage. asp' into
          the processing one, and it seems to work rather well.

          But thanks anyway.

          Colin

          Comment

          • Aaron [SQL Server MVP]

            #6
            Re: Alternative to Response.Redire ct




            --
            Please contact this domain's administrator as their DNS Made Easy services have expired.

            (Reverse address to reply.)




            "Colin Steadman" <anonymous@disc ussions.microso ft.com> wrote in message
            news:708101c4cb e5$febd61b0$a30 1280a@phx.gbl.. .[color=blue]
            > I'm looping through an array of employee numbers and
            > sending them to an Oracle procedure for processing. While
            > I'm doing this I'm updating a <DIV> tag in the browser
            > with index number of the current array item so the user
            > knows how far along in processing we are. The ASP looks
            > something like this:
            >
            > <div id=messageToUse rTxT>Please wait...</div>
            >
            > <%
            > For i = LBound(arrayOfE mployeeNumbers) To _
            > UBound(arrayOfE mployeeNumbers)
            >
            > '...Generate and execute SQL
            > cn.execute SQL
            >
            > %>
            > <script language=javasc ript>
            > document.getEle mentById('messa geToUserTxT').i nnerText
            > = 'Processing <%=i%> of <%=UBound(array OfEmployeeNumbe rs)%[color=green]
            > >';[/color]
            > </script>
            > <%
            > Response.flush( )
            > Next
            > %>
            >
            > This does exactly what I want it to do, but I now get this
            > error when I try and redirect the user to another page
            > when the processing is complete:
            >
            >
            > The HTTP headers are already written to the client
            > browser. Any HTTP header modifications must be made
            > before writing page content
            >
            >
            > According to some posts I've seen in the forum this
            > happens because I've already written some HTML to the
            > browser.
            >
            > I was wondering therefore if there is any way I could
            > redirect the user to the next page using some other
            > mechanism? I seem to recall an alternative to using
            > Response.Redire ct, but I cant remember what it is!
            >
            > Any ideas?
            >
            > Thanks,
            >
            > Colin
            >
            >[/color]


            Comment

            Working...