Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not find User.Identity.GetUserId() Method

Using Visual Studio 2013 Express MVC application with references to MVC 5.2 Asp.Net.Identity.Core 2.0

inside any controller or from anywhere else in my application the method GetUserId() does not seem to exist and I can not for the life of my understand how that could be. I was under the impression it was a method included in Asp.Net Identity 2x. What might I be missing here?

like image 458
Mark Hollas Avatar asked Apr 07 '15 06:04

Mark Hollas


2 Answers

It is an extension method. Reference the name space at the top of the class.

using Microsoft.AspNet.Identity;
like image 94
faisale Avatar answered Nov 07 '22 01:11

faisale


Since 2015 RC1 the GetUserId extension method is in the System.Security.Claims namespace.

like image 2
Menno Guldemond Avatar answered Nov 07 '22 00:11

Menno Guldemond