You can't use standard dialog boxes in a webpage as these are for windows forms (well ok you can get them to work in a sense but they will only display on the server which wouldn't be any good to you).

For small messages such as 'login details not recognised' I'd just display them in a label on the page (I know as a user i'd also prefer this than rather having to close a messagebox everytime).

For application errors incorporate error handling to catch them.