Response.Redirect


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Response.Redirect

  1. #1
    Join Date
    Apr 2004
    Location
    Indiana
    Posts
    15

    Response.Redirect

    Hi,

    I'm new to ASP.NET and I want to redirect the user to a page after completing an evaluation and sending them a window.alert.

    Here's my code:

    Private Sub Submit_Click( s as Object, e as EventArgs)

    InsertVendor()

    Session("VndrID") = intVndrID

    InsertEvaluation()

    Response.Write( "<script language='javascript'>window.alert('Thank You. The evaluation was completed successfully.');</" + "script>" )

    Reponse.Wrtie( "home.html")

    End Sub


    The problem that I have is that the user is redirected to Home.html without the javascript window.alert.

    Should I add this functionality in my Response.Write with javascript or is there any other ways to do this, maybe a pause?

    Any ideas would be appreciated.

    Thanks,

    b

  2. #2
    Join Date
    Mar 2004
    Location
    Jacksonville Florida USA
    Posts
    228
    When this code fires the js will be output into your html page, the problem is the html page that you create is never sent to the user so you in reality write nothing out. If you are redirecting them in the same block of code that is fireing, yes the write fires, but that page never makes it to the user. To get that redirect to fire and the js to fire you have to break them up, and to get both events to fire separatly the page will have to be resent two times. If you want to keep the js your best option would be to write out a meta redirect that is set for 3 or 4 seconds. An option better then that would be to ditch the js and redirect the user to a page that says thank you and hack a back link.

  3. #3
    Join Date
    Apr 2004
    Location
    Indiana
    Posts
    15
    Thanks for the reply. I took your advice and went with the thank you html page, then redirected them to the home page.

    Thank you,

    b

  4. #4
    Join Date
    Mar 2004
    Location
    Jacksonville Florida USA
    Posts
    228

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center