http://www.vbforums.com/archive/index.php/t-395604.html
Why not?

When I hit an exception in my code behind, can I put up a windows-style message box? I'd like to pass the variable ex.message to it, but none of these is working:
Code:
            ' Response.Write("<script language='javascript'>alert(ex.message);</script>")
            ' Response.Write("<script language='javascript'>alert(" + ex.Message + ");</script>")
            ' Response.Write("<script language=javascript>alert('This is a dynamic alert.');</script>")