I have an MVC4 application set up with multiple areas. Each area must have its own login page. Let's say for example I have the following areas:
Main Admin
How can I set it so that the "Main" area has a different login page to the "Admin" area? I'm thinking web.config is not the way to go on this.
Currently I have the following in my root web.config file:
<authentication mode="Forms">
<forms loginUrl="~/Admin/Login" timeout="2880" protection="Encryption" />
</authentication>
However, I'm struggling to work out how to adapt this to MVC4 with areas.
Please help.
Many thanks to Ufuk Hacıoğulları for putting me on the right scent. My final solution was this:
I don't know if you can make it work with configuration files in each folder. Use that solution if you can. If you can't, here's a custom action filter that you can use:
You may need to fix route names, I can't remember if ASP.NET MVC generated a route for each area. Then you can use it like this: