Problems getting Forms Authentication to work with a child MVC application

Recently we had an issue where we were trying to create an MVC (I think MVC5) web app that was going to be a virtual application off of a parent .net webforms application. By this I mean that the root of the site was a webforms app, and the new MVC app being created was ~/Whatever.

We were having some problems getting the authentication ticket from the parent site to work in the new MVC app. Both sites were running under the same app pool. We had other apps running the same way without problem. What was the issue?

Well, I believe it turned out to be that the MVC app specified .net 4.5 in it’s web.config file, while the root application was running with .net 4.0. The problem line was:

<httpRuntime targetFramework=”4.5″ />

As soon as we removed that line from the web.config it started working.

This stackoverflow post seems to suggest the same thing (not the answer with 3 upvotes, the one with 26).

It says:

If your forms authentication ticket needs to be shared between applications using an older version of the .NET framework, you must explicitly configure your .NET 4.5 apps to use the earlier machine compatibility modes, or they will not be able to encrypt/decrypt the forms authentication ticket.

In your .net 4.5 application’s web.config, set the compatibility mode attribute:

<machineKey compatibilityMode=”Framework20SP2″ />

This will allow your .NET 4.5 apps to work with forms authentication tickets generated by earlier .NET versions.

Note: If any of your servers do not have .NET Framework 2.0 SP2 installed, you will need to set the compatibility mode to “Framework20SP1” instead.

We didn’t do this exact same fix, we just removed the one line from the new webapp’s web.config, but it sounds like the same problem.


Trying to use more than 1 WD “My Book” external drives?

I ran into a problem with a client today where we were trying to add some USB external storage for added onsite backup storage. The problem was, it never seemed to show more than 1 of the 2 external drives.

I tried the 2nd drive that wouldn’t show up on other machines, and it worked fine.

Turns out the problem exists in more recent version of windows. This happened on Server 2012. If 2 devices are connected, it will only assign 1 of them a drive letter if they have identical signatures.

WD My Book hardware ID collision

This explains the fix using diskmgmt: