0

I already have a MVC 5 web application that uses sql server authentication. I am only using AspNetUser and AspNetRole table from EntityFramework and rest are custom tables. Important custom table is UserGroupRole that joins AspNetUser,AspNetRole and a Custom table called UserGroup that user have access to.

How can I easily convert this to Windows (Active Directory) authentication and still retain logic that I currently have.

One part of solution I am thinking is that if I can use AspNetUser table to store Active Directory users without password then I can retain most of code.

Thanks.

ary
  • 939
  • 2
  • 13
  • 32

1 Answers1

0

This helped me.

Windows Authentication not working in ASP.NET MVC 5 web app

I was able to retain logic by still using AspNetUser table.

To get the windows logged in user name I used

HttpContext.Current.Request.LogonUserIdentity.Name.Split('\')[1]

I guess you can also use

User.Identity.Name.Split('\')[1]

Community
  • 1
  • 1
ary
  • 939
  • 2
  • 13
  • 32