CDO 1.2 to Exchange 5.5 in asp.net RRS feed

  • Question

  • User-1088104194 posted
    I have some code below that logs onto my exchange server and displays all the folders in the mailbox. Works fine under asp but not under and ASPX page. That same code place in an ASPX page on the same server in the Page_Load fails with a CDO athentication error: The information store could not be opened. [MAPI 1.0 - [MAPI_E_LOGON_FAILED(80040111)]] Now seeing as this is the same code the problem has to be in how the CLR is handling the creation of the the MAPI object I think. I have just started with ASP.net so have not got a full grasp on all the secrutiy goings on. Below is the code that works in an asp page but not on a aspx page on the same server even in the same directory. Thanks 'Put user code to initialize the page here Dim bstrServer As String Dim strAlias As String Dim objSession As Object Dim bstrProfileInfo As String Dim objInfoStore As Object Dim RtFolder As Object Dim objFolders As Object Dim ObjFolder As Object Dim subfolders As Object Dim Nameval As String Dim SubFolder As Object bstrServer = "app" 'the name of the Exchange 5.5 server. strAlias = "brianh" ' Create the CDO session object objSession = CreateObject("MAPI.Session") bstrProfileInfo = bstrServer + vbLf + strAlias 'Logon objSession.Logon(, , , True, , True, bstrProfileInfo) ' Get your default information store objInfoStore = objSession.GetInfoStore("") ' Get to the root folder RtFolder = objInfoStore.RootFolder ' Loop through all the folders. objFolders = RtFolder.Folders ObjFolder = objFolders.GetFirst() For Each ObjFolder In objFolders Nameval = ObjFolder.Name subfolders = ObjFolder.Folders If subfolders.Count > 0 Then SubFolder = subfolders.GetFirst() For Each SubFolder In subfolders Nameval = SubFolder.Name Response.Write("Folder: " & Nameval & "
    ") Next End If Next 'Logoff and release all the objects objSession.Logoff() objSession = Nothing
    Saturday, August 24, 2002 2:59 AM

All replies

  • User-1088104194 posted
    I found the problem, I needed to set the authentication to impersonate and it now works. Now I can continue :)
    Saturday, August 24, 2002 11:28 AM
  • User1120147460 posted
    hello, we have the same problem, in which part of code do u set the authentication type? thanks in advance.
    Tuesday, October 29, 2002 7:59 AM
  • User-245947470 posted
    Please, how you put it in your asp.net application Regards, Diego
    Monday, July 28, 2003 2:05 PM
  • User1853872439 posted
    Does anyone know how to get this to work in C#? C# won't let you call members from within Object class without jumping through hoops. Can we declare Session, Folder, Message etc. objects or something?
    Tuesday, August 12, 2003 3:28 PM
  • User1487293039 posted
    In the web.config file try the following: <identity impersonate="true" userName="domain\user" password="pw" /> Enter your domain\user and password for the user you want to impersonate. I have this tag immediately after the <authentication></authentication> tag. Here is an MSDN page with some more info: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfidentitysection.asp My problem is that for it to work, I have to impersonate an administrator and enter its password in clear text. Bad for security. I am looking for a way to solve this problem. Any ideas?
    Tuesday, August 26, 2003 10:02 AM
  • User380963990 posted
    I am developing an app to send MAPI mail from vb.net, and have experienced many of these same issues over the past week. I must send MAPI and not SMTP, as many of the junior managers in my company do not get SMTP mail addresses. After a week of experimentation and advice, I finally got past the errors described above, but still have a problem. I get past the Logon ok, but when I hit the following line to start a message (with the arrow), it simply hangs indefinititely. Is there something that must be set up on the Exchange 5.5 box? Is there a log file on the Exchange box where I can see what is happening? Here is the code: ' start the session Dim objsession As Object objsession = CreateObject("mapi.session") Dim profileinfo As String profileinfo = "exchangeserver" & vbLf & "mailboxalias" objsession.Logon("", "", False, True, 0, True, profileinfo) ' start the message Dim objmessage As Object objmessage = objsession.Outbox.Messages.Add '<================= objmessage.subject = "This is a test." objmessage.Text = "This is the message text." ' add receipients Dim objRecipients = objmessage.Recipients objRecipients = objmessage.Recipients.Add objRecipients.add("RecipientAlias") ' check for valid recipient objRecipients.Resolve() 'Send the message objmessage.Send() 'Logoff objsession.Logoff() objsession = Nothing Any assistance would be greatly appreciated.
    Monday, October 27, 2003 11:00 AM