That's not right. You can't use WinForms code to do that in ASP.NET . There isn't a DialogBox control.
It's a little more complicated than that. The way I normally make a modal dialog box is to use the Modal Popup control in the AJAX.NET toolkit. You can build a panel, lay it out to look like a MessageBox, and then at the right time call an event to pop it up.