i have an asp.net mvc application that has authentication set to none in the web.config but would like to secure one view with windows authentication. is there any easy/good way to do this without changing the authentication configuration?
A:
Think you'll need to use the Authorize Attribute.
Any reason you can't set Authentication mode to Windows for the project?
davewasthere
2009-12-10 14:03:00
Authorize uses asp.net authentication, as far as I know, which I don't have by choice.Yes, I can't set Authentication mode to Windows b/c I have my own authentication framework.
chief7
2009-12-10 15:42:34
A:
Can you write your own authorize attribute which when applied to your method checks a few things, routes you to a challenge page or performs some other action that will satisfy your credentials?
Unsure what you'll use to authorise the user. Maybe check IP, Active Directory user name etc.
If you do it like this then you can re-use the attribute on other pages which would be nice.
griegs
2009-12-11 04:11:21
I agree but, I haven't found a great way to get users credentials. I would like to use the standard "not authorized" http status code which prompts the browser to ask the user for creds. I have not found any code which does this. I may have to write it myself.
chief7
2009-12-11 13:20:23