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
 
M

mfreidge

John,
I have a similar problem. I am using client on workstation running IE
that login to ASP.NEt web server using Windows Authentication wit
impersonation. The server ASP.NET page uses WebDav to access Exchang
Server 2003. THe WebDav request failes with "The remote server returne
an error: (401) Unauthorized".
If the client is running IE browser on the Web Server , WebDav querie
are succeded.
I've changed Web Server to "trust this computer to delegate", but th
error is the same.

Have you solved your problem?
Regards,
Michael Freidgei
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top