小编Gaz*_*wan的帖子

警告不在asp.net中显示异常变量

我想在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.

javascript asp.net

1
推荐指数
1
解决办法
886
查看次数

标签 统计

asp.net ×1

javascript ×1