Results 1 to 7 of 7

Thread: Redirect

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    This is doing my head in....
    how do i redirect after updating a database to see latest entries

    code: extract

    FOR i = 1 to RSAddrecord.Fields.Count -1
    'RS.Fields(i).Value = RS.Fields(i).Name
    if(RSAddrecord.Fields(i).Name <>"ID" ) then
    RSAddrecord.Fields(i).Value = Request.Form(RSAddrecord.Fields(i).Name)
    end if
    if(RSAddrecord.fields(i).Name = "date") then
    RSAddrecord.Fields(i).Value = Now()
    end if
    NEXT
    RSAddrecord.Update
    end if
    RSAddrecord.Close
    GobjConnect.Close
    Update = 1
    session("update") = Update
    End Sub

    Response.Write "</table>"
    Response.Write "<a href=default.asp?mode=1>Login</a>"

    Response.Write "</body>"
    Response.Write "</html>"
    If session("update") = 1 then
    Response.Redirect("default.asp") /// i get waring that headers are already written
    end if
    %>


    Many thanks
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Response.Redirect must be called before any Response.Write's.

    Josh
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    Guest
    Do you know Any Javascript. If you do you can put a hidden text box in the page. When the page first loads have it set to 0 and when you have updated change it to 1.
    Put a JavaScript event on the hidden field and when it's changed run this script:
    {
    document.location = "www.mypage.com"
    }

    that's probably not much use, I took pity on you not having any replies.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    The Repsonse.redirect is called before the repsonse.write's, this is the last event of the page...

    Any help Ian?? seems your the man
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  5. #5
    Hyperactive Member Kagey's Avatar
    Join Date
    Sep 2000
    Location
    The Wilderness of New Brunswick
    Posts
    294
    put Response.Clear right before the response.redirect. that should do the trick mate.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Got this message

    Response object error 'ASP 0159 : 80004005'

    Buffering Off

    /comp/default.asp, line 256

    Buffering must be on.
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Manchester
    Posts
    446
    Put at the start this
    response.buffer = true

    seems to whirl away and do nowt..
    "Life isn't about finding yourself. Life is about creating yourself."
    --George Bernard Shaw

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width