I have some static (pure html) pages in my MVC application that I need to authenticate, so that not just anybody can look at them. Is there an way to do this without moving all the code to asp files and adding a controller and from there use the Authorize attribute? I would really prefer to not need to do this!
2 Answers
If those static HTML pages are in a separate folder, You could configure IIS & Windows Folder security using IIS Admin.
You might also want to look at role based security , however I'm not sure if that will work for static HTML files (non .aspx).
2 Comments
Mac Attack
Thanks! I looked into role based security, and our solution to block out any user who was not logged in is as follows: <location path="StaticPages"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> worked like a charm!
7wp
You must be using IIS7 then, since my suspicion is that this would not be possible in IIS6... Is that true?