redirect with asp?

databases United States
  • 19 years ago

    how can i redirect to a different page after a record is updated or deleted?


    update page: userup.asp
    delete page: userdel.asp
    response page: success.asp


    is this possible?


    thanks for any idea

  • 19 years ago

    You can use

    Code:
    Response.Redirect
    to redirect. You may need to put Code:
    <%Response.Buffer=True%>
    if any output could be sent before the redirect (you can't redirect if any output is sent when Response.Buffer isn't true).


    Let me know if you need more information.

  • 19 years ago

    should i put <%Response.Buffer=True%>  in the head of the page, and then something like:


    if Response.Buffer<>True then
    response.redirect success.asp
    end if


    what is REsponse.buffer doing? is it checking for data passed to the ado file?  


    Thanks for your help!


    Daniel Okely said:

    Quote:
    You can use Code:
    Response.Redirect
    to redirect. You may need to put Code:
    <%Response.Buffer=True%>
    if any output could be sent before the redirect (you can't redirect if any output is sent when Response.Buffer isn't true).


    Let me know if you need more information.


  • 19 years ago

    Response.Buffer tells the server that, instead of sending the page to the browser as it is processed bit by bit, it should wait until it has finished processing and send the whole page at once. For more info see the ASP documentation.


    I don't think


    Quote:
    if Response.Buffer<>True then
    response.redirect success.asp
    end if


    would work.


    I think what you should do is put

    Code:
    Response.Redirect success.asp
    after the code that updates the database. eg.


    Code:

    <%
    '...
    'code that acts on the database


    'send them to the success page
    Respose.Redirect "success.asp"
    %>



    On my site I use code in my links section to update the hit count for a site then do a redirect to it, and it works.


    Again, let me know if you need more information.

  • 19 years ago

    That is where the problem is. I am creating the asp pages with GoLive, so to update  users' records, i use a form with the following code:


    <form name="userup" action='/config/actions/ado.actions5.asp?<%=URLArgs()%>' method="post" onsubmit="return checkPass()">


    This file ADO cannot be changed. I need to put the response.redirect code, in some place where the computer will only redirect the page, once it comes back from the ADO file and updated the records. But where?.


    if i put it on the page, it redirects the page as soon as you enter it.




    Daniel Okely said:

    Quote:
    Response.Buffer tells the server that, instead of sending the page to the browser as it is processed bit by bit, it should wait until it has finished processing and send the whole page at once. For more info see the ASP documentation.


    I don't think


    Quote:
    if Response.Buffer<>True then
    response.redirect success.asp
    end if


    would work.


    I think what you should do is put

    Code:
    Response.Redirect success.asp
    after the code that updates the database. eg.


    Code:

    <%
    '...
    'code that acts on the database


    'send them to the success page
    Respose.Redirect "success.asp"
    %>



    On my site I use code in my links section to update the hit count for a site then do a redirect to it, and it works.


    Again, let me know if you need more information.


  • 19 years ago

    Can't you do the ADO bit, and put the Response.Redirect afterwards?

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” - Donald Knuth