5

I'm attempting to create a simple Web API controller to act as a WebDAV server, as I only want it to allow directory listings and read access to files, as well as integrate with the current authentication system we have in our system.

I've managed to get the directory and file listing working when using a WebDAV client (DAVExplorer), however mapping a network drive in Windows Explorer is just not playing ball.

Whilst I haven't worked out why this isn't working, one possibility is that when a WebDAV server returns the results of a PROPFIND request, it does so with a Http Status Code of 207 Multi Status. This doesn't appear to be in the HttpStatusCode enumerator that is used by the HttpResponseMessage object.

I've tried to find out what actually turns the HttpResponseMessage into the response returned to the browser, thinking I could implement my own version and deal with outputting the status code myself, but I've not had any luck with that so far.

Anyone got any suggestions for how I might implement an API Controller that returns a 207 status code?

1 Answer 1

8

You can cast any int to HttpStatusCode

public HttpResponseMessage Get()
{
    var response = Request.CreateResponse((HttpStatusCode)207, "something");
    return response;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.