This project has moved. For the latest updates, please go here.

Microsoft.Owin.StaticFiles and authentication

May 1, 2014 at 8:26 PM
How would I add protected (i.e. requires authentication) static file routes with Owin and FileServerOptions? For instance, all files served under RequestPath = '/app/private' require user authentication, but files served under '/app/public' do not.

James
Coordinator
May 1, 2014 at 8:39 PM
It's recommended that you perform Authorization checks before the static file middleware, based on whatever information you think is important (path, user, etc.).
Aug 12, 2014 at 4:17 PM
Ok. If I use ASP.NET Identity middleware, I always get 401.3 - Unauthorized, if user is not authorized. What should I do to fix it?
Nov 12, 2014 at 11:16 PM
Edited Nov 12, 2014 at 11:16 PM
dmitriy_dokshin wrote:
Ok. If I use ASP.NET Identity middleware, I always get 401.3 - Unauthorized, if user is not authorized. What should I do to fix it?
Do you have an example of how you did that? I'm not able to authorize the static file middleware..
Coordinator
Nov 12, 2014 at 11:19 PM
Nothing in Katana ever set IIS sub-status codes (.3). Are you sure the request is not being handled by the IIS static file module?
See: https://katanaproject.codeplex.com/wikipage?title=Static%20Files%20on%20IIS&referringTitle=Documentation