Windows Authentication with WebDav

J

John Smith

Hey folks,

I'm trying to communicate with our Exchange server using WebDav to get the
User's personal contacts folder. Works fine if I hardcode their username
and password (obviously not an acceptable solution), but when I use
Integrated Authentication I get "(401) Unauthorized".

I've got <identity impersonate="true" /> and I've got <authentication
mode="Windows" />, and I've set up IIS to use Windows Authentication. I
know this works, because I can log into our SQL Server using it.

How do I use the logged in user's credentials to work with WebDav?


The following works fine:
MSXML2.ServerXMLHTTP30 oXmlHttp = new MSXML2.ServerXMLHTTP30();
oXmlHttp.open("PROPFIND", "http://theUrl", false, "Domain\\user",
"password");

This following two produces the error though:
1:
HttpWebRequest Request = WebRequest.Create("http://theUrl") as
HttpWebRequest;
Request.Credentials = CredentialCache.DefaultCredentials;

2:
Principal.WindowsIdentity currWinID =
(Principal.WindowsIdentity)User.Identity;
Principal.WindowsImpersonationContext ic = currWinID.Impersonate();
HttpWebRequest Request = WebRequest.Create("http://theUrl") as
HttpWebRequest;
Request.Credentials = CredentialCache.DefaultCredentials;
 
P

Pat

John i think you might have to Hardcode it..
I think its not just passing your Atuthentication as you said if you have
imperosnated the user and still doesn't work
What i guess is it can't pass your credentials to the next hop its should be
something with delegation i think it won't do it if you are using
NTLM but with kerberos it should work
Try posting your problem to the security GROUP
Patrick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top