NTLM Authentication

  • Thread starter Thread starter Alexander Gnauck
  • Start date Start date
A

Alexander Gnauck

Hello,

i need to perform NTML Authentication with SMTP against a exchange server. I
cant use existing libraries like CDO. The type1 and type2 mesages work OK.
Now i have to create the type3 message to authenticate. Are there any .NET
classes that i could use to create the NTLM response? Or smth else that can
do the NTLM authentication for me?

Thanx Alex
 
Alexander,

You are handling the NLTM authentication yourself? I think that is not
a good idea, since you probably will not get it right, and if you do, you
will have to maintain that code.

Why can't you use libraries like CDO?
 
hello,
You are handling the NLTM authentication yourself? I think that is not
a good idea, since you probably will not get it right, and if you do, you
will have to maintain that code.

yes i handle it myself. I have seen internal classes in the framework with
the Reflector that are sealed :(. So i have no other chance i think.
Why can't you use libraries like CDO?

only one reason is that there is no support for Socks 4 and 5 Proxies in
CDO. What do you mean with "maintain the code"?

Alex
 
Hello,

found a Java Library at http://jcifs.samba.org/ and managed c# code from
Mono. So i extended this code a bit and it works pretty well. Similar code
is already in the Framework. Why does Microsoft seal this classes? Much
easier to develop with Mono here.

Alex
 
Not sure why you don't simply use System.Web.Mail here to connect to
Exchange server using smtp?
The Mailmessage class makes it possible to select NTLM as authentication
protocol when connecting to Exchange.

Here is how you could do this:

MailMessage mail = new MailMessage();
.....
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"2"); // select NTLM (2) authentication

// add user and password
mail.Fields.Add(http://schemas.microsoft.com/cdo/configuration/sendusername",
"usernameHere");
mail.Fields.Add(http://schemas.microsoft.com/cdo/configuration/sendpassword",
"userPwd");

SmtpMail.Send( mail );

Willy.
 
Not sure why you don't simply use System.Web.Mail here to connect to
Exchange server using smtp?

because it has no support for SOCKS4, SOCKS5 and other Proxies i need. Also
this class is only a wrapper to cdo which is not available on 9x Systems.

Alex
 
Back
Top