httphandler doesn't work when document name or guid included

Jun 26, 2014 at 5:12 PM
Edited Jun 26, 2014 at 5:14 PM
I entered the following in web.config
<add verb="*" path="MyDAV" type="PetkaWebDav.Handler.FileSystem.FileSystemWebDavHandler, PetkaWebDav.Handler.FileSystem"/>
I then set a few breakpoints before running the application so I could determine if the setting in web.config was working. I also, registered the route
routes.IgnoreRoute("MyDAV/{*pathInfo}");. 
I'm using MVC2.

The results are that my breakpoints are hit when I enter this into the browser:
http://localhost:51946/MyDAV
But when I enter this the breakpoints aren't hit.
http://localhost:51946/MyDAV/test.docx
I must be missing something about the route that I registered and how the request is treated when the file name is included. Shouldn't the route I registered ignore all /MyDAV requests? Is there something else I missed?
Jun 26, 2014 at 5:40 PM
Edited Jun 26, 2014 at 5:42 PM
So it seems I missed the significance of {*pathInfo} as including this seems to allow info from in the url like this:
http://localhost:51946/MyDAV?id=1
Now I see that the route I registered ignores the url that includes the id because it is part of pathInfo.

But this doesn't explain how the sample website works using the url:
http://localhost:46961/wordstorage/Test-2.docx
When I do this the httphandler never gets the request because, it appears, the url doesn't match any of the routes including the route set to ignore the DAV requests. In other words it seems including the name causes MVC to keep looking, and eventually fails to find, a controller for MyDAV which doesn't exist resulting in a 404 error.
Jun 27, 2014 at 12:11 PM
Edited Jun 27, 2014 at 12:12 PM
Just in case this is useful to someone (like myself later) I couldn't get this url to work:
http://localhost:46961/wordstorage/Test-2.docx
So I registered this route to get the docuement:
routes.IgnoreRoute("{resource}.docx/{*pathInfo}");
This lets me ask for the document like this:
http://localhost:46961/Test-2.docx
I can also now pass in additional information like this.
http://localhost:46961/Test-2.docx?fileid=123456
In summary, the demo video appears to work fine so I suspect the problems I'm having relate to MVC2. According to the title of the project it appears it was created for MVC4. So if you're like me and are using MVC2 you might need to change the routing like I did. I also had to change the way the file system handler got the file name and mime type as I changed the location of the file name in the url.
Jun 27, 2014 at 1:20 PM
This also works if you want to continue using wordstorage in the url:
routes.IgnoreRoute("wordstorage/{resource}.docx/{*pathInfo}");
The url is then:
http://localhost:46961/wordstorage/Test-2.docx?fileid=123456