How to change when azure access control service login is displayed instead of when the application is run

106 Views Asked by At

I'm trying to add the option of authentication using Azure Access Control Service to my website, all the functions work correctly but I would like to change when it redirects to ACS to login instead of when my application is first run. Is there any possible way to do this?

Any help with be much appreciated

Thanks.

1

There are 1 best solutions below

0
On

If it happens when your application first runs then you probably set it to deny access to everything in your main web.config. If that's the case you can set it to allow everything and then decorate the controller(s) that you want to require authentication with the [Authorize] attribute.

[Authorize]
public class MyController : Controller

You can also set the [Authorize] attribute on individual actions as well. This pattern will give you a more granular control to when you want to authorize.