How to display an error message box in a web application asp.net c#

后端 未结 7 1396
小蘑菇
小蘑菇 2020-12-03 18:28

I have an ASP.NET web application, and I wanted to know how I could display an error message box when an exception is thrown.

For example,

                 


        
7条回答
  •  孤街浪徒
    2020-12-03 19:07

    You cannot just call messagebox.write cause you are disconnected from the client. You should register javascript code that shows a messagebox:

    this.RegisterClientScriptBlock(typeof(string), "key",  string.Format("alert('{0}');", ex.Message), true);
    

提交回复
热议问题