我想在asp.net 4的警告框中显示异常.但它没有显示任何警报.我试过这些解决方案 -
try{// my code}
catch (Exception ex)
{
//Response.Write("<script>alert('" + Server.HtmlEncode(ex.Message) + "')</script>"); // Not Working
//Response.Write("<script>alert('" + ex.Message + "');</script>"); // Not working
// Response.Write("<script>alert('" + Server.HtmlEncode(ex.ToString()) + "')</script>"); // Not working
//ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "done", "alert('Error Occured.');", true); // Only this is working.
}
Run Code Online (Sandbox Code Playgroud)
如果我出错,请建议任何解决方案.
谢谢和问候,Rizwan Gazi.