Question

I am creating a new MVC 4 app for a client that I had previously created ASP.Net 3.5 (VS 2008) apps for. I created a gateway app to launch several other ASP.Net 3.5 web apps, with the gateway app handling the login and the forms authentication ticket.

As long as all of the other web apps have the same settings for the forms authentication and machine key sections all other apps were able to use the forms auth objects to see if the user was authenticated.

I am now creating a new MVC 4 app using the same forms authentication settings in VS 2010 on an XP development box using IIS 5.x. (I have to do this) The problem is that the gateway app launches the MVC app fine with no login; however, if I add the Authorize attribute to initial controller the MVC app goes to the login and then the launch page as expected, however the link to the MVC app goes right back to the gateway login page.

Here are the web config sections

<authentication mode="Forms">   <forms
        slidingExpiration="true"
        timeout="3"
        loginUrl="http://localhost/MYGateway/Login.aspx"
        path="/"
        name=".PGSA"
        protection="All"
        defaultUrl="http://localhost/MYGateway/home.aspx"
        >   
  </forms>

<machineKey   validationKey="C5123C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D9401E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51F17C529AD3CABE" decryptionKey="8A9BE8FD67AF6979E7D29998CFEA50DD3D3799C77AF2B72F"   validation="SHA1"   decryption="3DES"    />

Any help would be appreciated Thanks, Paul

Was it helpful?

Solution

I was finally able to get this solved, thanks to this question's second answer by James H Upgrading to ASP.NET 4.5/MVC 4 forms authentication fails

The trick is this

<system.web>
 <machineKey compatibilityMode="Framework20SP2" /> 
</system.web>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top