I have seen frequently that beginners in ASP.NET trying to use Windows Forms MessageBox and fails.
I would like to say that MessageBox class is meant for Windows Forms Application and not ASP.NET Web applications.
In ASP.NET applications, you have to:
Use either a page to show the message
Create a new web application using File > New Project > Web > ASP.NET Web Application
In the solution Explorer, right click on the Default.aspx and use View Code command.
Replace the Page_Load method code as below:
protected void Page_Load(object sender, EventArgs e)
string message = "Test Messsage Box in ASP.NET";
string script = "";
ClientScript.RegisterStartupScript(GetType(), "key", script);
Now you can execute the application.