Hi alya14,
Refer the below link.
http://stackoverflow.com/questions/28339010/my-message-box-in-asp-net-does-not-work-on-the-server-so-what-is-it-used-for
The System.Windows.Forms.MessageBox and System.Windows.MessageBox classes are for displaying message boxes in Windows forms applications and Windows WPF applications, i.e. client applications.
If you try to use those in a web application, it would show the message box on the web server, not on the client computer. As a web application runs in an account without a user interface (no logged in user), there would be nowhere to show the message box.
In a web appication you would use the window.alert or window.confirm methods in Javascript to show a simple popup message. If you search for message box web server control you will find several examples of web server controls implementations and alternatives.