I have an ASP.NET MVC site that uses forms authentication with a custom AuthorizeAttribute for both actions and controller classes.
I have this in my web.config file:
<authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" timeout="2880" /> </authentication>
When the site is in "normal" mode, it works fine. Users who need to log in are redirected to this page.
But when I switch to test mode, all Controllers will be locked, as well as AccountController.
Now I need to change the loginUrl value when I am in test mode to indicate a controller action that is not blocked, and this is specially done for the test scenario.
How can I change loginUrl or can I redirect from AuthorizeAttribute ?
source share