SOLVED: 'System.Security.Principal.IIdentity' does not contain a definition for 'GetUserId'

While following a tutorial I got the error that GetUserId() didn't exist. Right clicking to refactor the reference in didn’t come up with any suggestions. Luckily it wasn’t too tricky to solve…


Error 1 'System.Security.Principal.IIdentity' does not contain a definition for 'GetUserId' and no extension method 'GetUserId' accepting a first argument of type 'System.Security.Principal.IIdentity' could be found (are you missing a using directive or an assembly reference?)


Its just an extension method but Visual Studio cannot automatically find the refactor suggestion for you.

You just need to add this using at the top of the file:

using Microsoft.AspNet.Identity;

The project compiled for me fine after that.

No comments :