In my C# website development project, I am faced with the challenge of displaying a message box using JavaScript. I have successfully implemented it using the following code:
Response.Write("<script LANGUAGE='JavaScript' >alert('Login Successful')</script>");
However, when I attempt to redirect to another page after displaying the message box like this:
Response.Write("<script LANGUAGE='JavaScript' >alert('Login Successful')</script>");
Response.Redirect("~/admin.aspx");
The message box fails to show up.
I am trying to understand why this happens and how I can resolve it. Any insights on this issue would be greatly appreciated.