3
votes

I have Windows Identity Foundation working well with MVC 3. However, in MVC 4 it seems WIF doesn't get a chance to handle the Not Authorized response and redirect to the STS - instead I get redirected to login.aspx, which is good old forms auth.

In MVC 3 I used to disable forms auth in web.config, but it doesn't work in MVC 4.

I know there have been changes to authentication and authorization in MVC 4, but my Google skills seem to have deserted me and I can't seem to find out how to stop forms auth interfering. Any pointers?

1

1 Answers

9
votes

Doh! Answering my own question here. All you have to do is remove the forms auth module by adding a remove element in web.config.

<modules>
    <remove name="FormsAuthentication" />
</modules>

I had actually tried this before but had used the wrong string: "FormsAuthenticationModule". I hope this helps some else who is having an off day. :)