Last post Nov 19, 2019 02:29 AM by Yang Shen
Nov 18, 2019 08:37 AM|shsu|LINK
I have few code after the message box. if certain condition didn't satisy then I want to show a message and redirect to home page.
below code when I place ,after redirecting it is executing the code below the portion of message box which is a saving process. As the project is live I don't want to change the full code. Thanks
ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Maximum number of Attempt for Test is 4. times');window.location='Userhome.aspx';", True)
when I put response .redirect under this code.message is not showing.
Nov 18, 2019 09:00 AM|PatriceSc|LINK
The location header sent by using Response.Redirect is processed first and the content of the page is basically irrelevant.
Depends on your overall approach but you could have the target page showing this message. You don't stay on the same page ? It seems a loign page and you show a message after 4 failed connexion attempts ?
Nov 19, 2019 02:29 AM|Yang Shen|LINK
As far as i know, Response.Redirect() is at the very top of the order where your program execute the code, especially around the alert message code.
You can refer to response.redirect executing before alert message and How
to get alert message before redirect a page.
I think you have found the solution to your problem, right? It doesn't work or you met some new problems?
By the way, if you used the window.location then you can quit the response.redirect.