From: Natarius_big on
Hello,
here my scenario:

I have wrote a simple custom authentication that allows anonymous access to
the WebDAV Directory like IIS6.
I connect to the WebDAV with the Windows 7 build in client. That works great.
When now i upload a file to this directory than this sporadic fails with an
error that this file already exists or that the file is been locked.
When i use the build in Windows Authentication than the upload works normally.
I hope someone can help me. :-)
Here my code:

using System;
using System.Security.Principal;
using System.Web;
namespace WebDavCustomAuthentication
{
public class Oxygen : IHttpModule
{
///
/// Initializes a module and prepares it to handle requests.
///
/// An that provides access to the methods, properties, and events common to
all application objects within an ASP.NET application
public void Init(HttpApplication context)
{
context.AuthenticateRequest += ContextAuthenticateRequest;
}

private static void ContextAuthenticateRequest(object sender, EventArgs e)
{
var id = new GenericIdentity("WebDav", "Custom");
var p = new GenericPrincipal(id, null);
HttpContext.Current.User = p;
}

///
/// Disposes of the resources (other than memory) used by the module that
implements .
///
public void Dispose()
{

}
}
}
And here the IIS Log:

First a file where is all right, next a file where the upload fails.

2010-04-20 10:27:47 192.168.0.174 PROPFIND
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 404 0 2 0
2010-04-20 10:27:47 192.168.0.174 PUT
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 201 0 0 15
2010-04-20 10:27:47 192.168.0.174 LOCK
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 200 0 0 15
2010-04-20 10:27:47 192.168.0.174 HEAD
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 200 0 0 15
2010-04-20 10:27:47 192.168.0.174 PUT
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 204 0 0 15
2010-04-20 10:27:47 192.168.0.174 PROPPATCH
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 207 0 0 15
2010-04-20 10:27:47 192.168.0.174 PROPPATCH
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 207 0 0 0
2010-04-20 10:27:47 192.168.0.174 UNLOCK
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 204 0 0 203

2010-04-20 10:27:49 192.168.0.174 PROPFIND
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 207 0 0 203
2010-04-20 10:27:49 192.168.0.174 DELETE
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/WebDAV+Einrichten.docx - 80
WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 200 0 0 187

2010-04-20 10:28:00 192.168.0.174 PROPFIND
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx - 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 404 0 64 0
2010-04-20 10:28:00 192.168.0.174 LOCK
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx - 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 400 0 64 0
2010-04-20 10:28:00 192.168.0.174 PUT
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx
- 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 201 0 64 15
2010-04-20 10:28:00 192.168.0.174 PROPFIND
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx - 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 207 0 0 15
2010-04-20 10:28:00 192.168.0.174 LOCK
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx - 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 200 0 0 15
2010-04-20 10:28:00 192.168.0.174 UNLOCK
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx - 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 400 9 0 15
2010-04-20 10:28:00 192.168.0.174 PROPFIND
/Upload/e4fe7043-3071-4a4d-978c-5d5058b17674/Windows+Media+Services+einrichten.docx - 80 WebDav 192.168.0.119 Microsoft-WebDAV-MiniRedir/6.1.7600 207 0 0 0
 | 
Pages: 1
Prev: IIS6 and SSL
Next: Default Documents and IIS 7