Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: - Trouble using CDO from ASP.NET


Message #1 by NK Ramanathan <nkram2000@y...> on Fri, 20 Apr 2001 23:27:39 -0700 (PDT)
Hi All,

I have a problem when using CDO from a ASP.Net web

form. My Mailer component is

a VB.Net dll



It goes like this



        Dim objSession As Object                  '

MAPI.Session

          Dim typSystem As Type



          typSystem 

Type.GetTypeFromProgID("MAPI.Session")

         objSession 

Activator.CreateInstance(typSystem)



        'Initialisations

        oArgs(gc_iZero) = Missing.Value

'ProfileName

        oArgs(gc_iOne) = Missing.Value

'ProfilePassword

        oArgs(gc_iTwo) = False    		'ShowDialog

        oArgs(gc_iThree) = True		'NewSession

        oArgs(gc_iFour) = -1		'ParentWindow

        oArgs(gc_iFive) = Missing.Value   'NoMail

        oArgs(gc_iSix) = "Bg1Mail" & chr(10) & "sasj" 

  'ProfileInfo



        typSystem.InvokeMember("Logon" ,

BindingFlags.InvokeMethod, Nothing, _

            objSession, oArgs)



In my ASP.Net web application's config file i have set



<identity>

<impersonation enable="true" user="SSL_PDC\sasj"

password="mypassword"/>

</identity>

inside my security tag. I have set authentication mode

to windows.

I have disabled anonymous access from IIS and enabled

Windows NT Challenge response.



The code for calling the Mailer goes like



		Dim wi As System.Security.Principal.WindowsIdentity

            wi 

CType(System.Threading.Thread.CurrentPrincipal.Identity,

System.Security.Principal.WindowsIdentity)

            wi 

System.Security.Principal.WindowsIdentity.GetCurrent()

            wi.Impersonate()

            oMailer.SendMail(sMsg)



I get an error like

Collaboration Data Objects -

[UNKNOWN_ERROR(80010106)]]

which is actually 

//

// MessageId: RPC_E_CHANGED_MODE

//

// MessageText:

//

//  Cannot change thread mode after it is set.

//

#define RPC_E_CHANGED_MODE              

_HRESULT_TYPEDEF_(0x80010106L)

from the WinError.h file

can someone throw me some light on it.



PS: I am using CDO from the MAPI subsytem that is

installed with W2K.



Thanks in advance.

Regards,

Ramanathan N.K.




  Return to Index