Closing popup on webserver

Hello,
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:

begin
# CONNECT TO MAPI SESSION
session = WIN32OLE.new('Mapi.session')
session.logon("#{profile_name}", "#{profile_pass}")
rescue Exception
@messege = "Could not connect to #{ip} with profile credentials!"
pass_mapi_session = 0
else
pass_mapi_session = 1
end

...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!!

Thanks,
- Jeff Miller