On Mar 7, 8:42 pm, "Jan" <cbcbc@xcvxwrote:
Hi,
Why don't i see the Alert box? The page is redirected without showing it. I
also tried with parameter 'False' and 'True'.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim a As Integer
a = 5
If a = 5 Then
Dim jv As String
jv = "<script language='javascript'>" _
& " alert(this is ok);" _
& "</script>"
Response.Write(jv)
Response.Redirect(next.aspx")
'Response.Redirect(next.aspx", False)
'Response.Redirect(next.aspx", True)
End If
End Sub
Thanks
Jan
Okay,
When you send a normal GET/POST request to a server, it generates a
response which consists of headers and content. Part of the headers
for a normal response it a status code - 200. This tells the browser
that the response is normal, and that it should go ahead and use the
rest of the headers and the content to display the page to the user.
When you use Response.Redirect on the server, it changes that status
code that is sent back to the client to 302. This status code,
essentially, says "what you were asking for has temporarily moved to
this new location", and provides the location information (in this
case, next.aspx). The browser just goes right ahead and requests the
next page - it never receives/processes and content associated with
the old page.
If you want to have a message box and then navigate to the next page,
you can put the navigation step into the javascript. Just add
window.navigate('next.aspx') to your script.
Damien