0

I have an ASP.NET MVC web application which is using Windows authentication. I can use HttpContext.User.Identity.Name to get the users username.

I need to be able to store and access additional fields for example full name, telephone etc. I don't have access to Active Directory. I was planning on creating a simple table in the database with with the Windows username and the additional fields as columns.

What is the correct/recommended way to implement this? I'd like to be able to do something like:

HttpContext.User.Identity.Telephone
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    you may need to create a model user class with all the additional column and derived it from IdentityUser Class – Sonal Borkar Dec 10 '18 at 19:27
  • First of all, AD has far more complex model than SAM. Phone nember is not in SAM. Anyway the IPrincipal built during NTLM negotiation is minimalustic - such properties are not fetched for performance reasons. So, you need to fetch them for yourself based on the username. – ZorgoZ Dec 10 '18 at 19:33
  • Please check [This Stakeoverflow Answer](https://stackoverflow.com/questions/1064271/asp-net-mvc-set-custom-iidentity-or-iprincipal) – Ali Adnan Dec 12 '18 at 05:38

0 Answers0