Closing popup on webserver

I've got an interesting problem... I'm running RoR on Windows Server
2003 (using Apache though, not IIS) and I have an app that does a test
to see if the user provided MAPI credentials are valid in MS Exchange.
If the credentials are good, it works fine. However, if I put false
credentials, then a confirmation window pops up on the server. This
makes my app hang and wait for the popup to close (which to the best of
my knowledge must be done manually). Since the app will be accessed from
computers other than the server, the user wouldn't know that there is a
popup making the app hang. I need to somehow find a workaround for
this... if anyone can help, it would be greatly appreciated. Here is the
relevant code:

session ='Mapi.session')
session.logon("#{profile_name}", "#{profile_pass}")
rescue Exception
@messege = "Could not connect to #{ip} with profile credentials!"
pass_mapi_session = 0
pass_mapi_session = 1

...and the popup that comes up on the server is:
"The profile name is not valid. Enter a valid profile name."
[ OK | Cancel ]

and apparently I need to click Cancel twice in order for it to close...

Any and all help is appreciated!!

- Jeff Miller