Re: Alert box doesn't appear



On Mar 7, 8:42 pm, "Jan" <cbcbc@xcvx> wrote:
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

.



Relevant Pages

  • Re: Alert box doesnt appear
    ... response which consists of headers and content. ... and provides the location information (in this ... If you want to have a message box and then navigate to the next page, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Newsgroups with large number of posts hangs OE
    ... My response was an unsubtle reference to my frustration with OE's bugs. ... settings in the large NGs I susbscribe to to "headers only" then use the "Sync All" button which then proceeds to d/l all the headers of these large NGs. ... I suppose that could possibly be due to the server of that particular NG.....I dunno. ... The best way to do this is to right click on the folder name in the folder list. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Igor, pAPP toolkit questions
    ... data will result in authorization and the same response at a later ... although this post deals with outgoing stuff and NTLM credentials, ... this using the pAPP toolkit that would be just excellent! ... > headers have been fully prepared. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: How could this possibly happen (HttpURLConnection + simple JSP page)
    ... In PHP that would throw some nasty HTTP-related warnings and potentially break the page as you are changing the headers after HTML display? ... You are writing code in a special format that is compiled in to a servlet, which is then executed by the server when the page is requested. ... The other thing is that writing things "after HTML display" is probably very difficult as the display is done on the users computer when they have recieved the response. ... When you create a response for the user it does not necessarily get sent back as soon as you start, and more importantly the headers do not necessarily finish as soon as you start writing to the body. ...
    (comp.lang.java.help)
  • Re: URLScan
    ... Are you using UrlScan to remove or alter the server header in the response? ... of headers at once. ... The symptom you'll seen when any ISAPI filter modifies any ...
    (microsoft.public.inetserver.iis.security)