We're busy porting a legacy ASP.NET web forms application to MVC. Some modules are finished with their valid Authorize attributes correctly set up, but only 1 module is going live.
So we must prevent the user from navigating to different modules (which are there, but not "live" yet). We don't want to meddle with the existing Authorize attributes, but users are currently not allowing access to these modules.
Here are my thoughts and shortfalls:
In
Global.asaxsubscribe toApplication_AuthenticateRequestand have a list of "Live" controllers, check the Request URL and throw and redirect to "Not Authorized page" if necessary. But how then I would would have to manually take routing into account where the URL maymysite/could route tomysite/Foo/Bar/.Could the traditional
web.configauthorizationbe used for this scenario? (This would be easier to maintain than number 1, but the web is littered with Don't do this in MVC's)
Something like this, where Customer is the controller:
<location path="Customer">
<system.web>
<authorization>
<deny users="*" />
</authorization>
</system.web>
</location>
- Alternatively take the plunge, comment out ALL the
Authorizeattributes from the controllers which aren't live :( hoping not to go down this route...
Any push in a better direction would be greatly appreciated.