I have a few lines of code that needs to run before the user get redirected to authentication part of my MVC4 Project.
I am using :
<modules>
<add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
<add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
</modules>
and
<authorization>
<deny users="?" />
</authorization>
The reason for doing this is that I need to add the site to Azure ACS if its not already added and i need to do this before the user is directed to ACS. Where would be the best place to run the code? (I need access to the url its coming from as thats what is needed to be given to ACS, so global.asax is not the right place i guess. (Assuming it can be started without a request coming in).