PRB: MAPI_E_LOGON_FAILED When Calling Logon MethodLast reviewed: December 30, 1997Article ID: Q178390 |
The information in this article applies to:
SYMPTOMSYou are unable to logon to Exchange Server when calling the Logon method of the Collaboration Data Objects (CDO) Session object in an Active Server Page. The following error is generated:
"MAPI_E_LOGON_FAILED"(NOTE: CDO was formerly known as Active Messaging.)
CAUSEIf an invalid profile name is entered, the error will be generated. The logon method must refer to an existing profile or must create a new profile. In most cases in an ASP, it is best to code the Logon method so that it creates a profile. The profile that is created is temporary and can be deleted when the CDO Session is ended. In order for an existing profile to be available on the server (where the Logon method is executed), the user you are authenticated as when you connect to the IIS machine must be logged on interactively on the server. This occurs because the Logon method searches the HKEY_CURRENT_USER key for the profile being requested. When IIS logs you onto the server, it is simply impersonating your user's security context and your profiles are not loaded into HKEY_CURRENT_USER.
RESOLUTIONThe way to create a new profile is to use the following syntax (this code should be on one line):
objSess.Logon "", "", False, True, 0, True, "exchangeServerName" & vbLF & "exchangeE-MailName" STATUSThis behavior is by design.
MORE INFORMATIONTo create a Active Messaging ASP page copy, paste the following code into an ASP file:
<%@ LANGUAGE="VBSCRIPT" %> <HTML> <BODY LANGUAGE=VBS> <% Const cStrServer = "<a valid Exchange Server name>" Const cStrMailbox = "<a valid Mailbox Alias>" bstrProfileInfo = cStrServer & vbLf & cStrMailbox 'insert a line feed Set objSess = Server.CreateObject("mapi.session") 'create session objSess.Logon "", "", False, True, 0, True, bstrProfileInfo Set objFBMess = objSess.Outbox.Messages.Add objFBMess.Subject = "Test Active Messaging" objFBMess.Text = "Greetings from Active Messaging in ASP" Set objRecips = objFBMess.Recipients objRecips.Add ("cstearns@msn.com") ' e-mail name to send message to objRecips.Resolve objFBMess.Send objSess.Logoff %> Mail Sent. </BODY> </HTML> Steps to Reproduce BehaviorTo receive the "MAPI_E_LOGON_FAILED" error, simply change the following line from:
objSess.Logon "", "", False, True, 0, True, bstrProfileInfoto:
objSess.Logon "dustin hubbard", "", False, True, 0, TrueThis CODE tries to use an existing profile that does not exist, thus generating the "MAPI_E_LOGON_FAILED" error.
REFERENCESFor more information about the parameters passed to the Logon method, please see the Online Help for Active Messaging and the "Logon Method (Session Object)" topic under Collaboration Data Objects in the Microsoft Developer Network Library (MSDN). For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, please see the following page on the Microsoft Technical Support site:
http://support.microsoft.com/support/vinterdev/ |
Additional query words: Active Messaging Logon Failed ActMsg OleMsg
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |