Search code examples
asp.netasp.net-mvcemailwindows-authentication

How to obtain email address with window authentication


I am designing a web application using the ASP.net MVC framework. I would like to use Windows Authentication and do Role Checks using the Role Manager SQLRoleProvider.

How can I determine the email address of the current logged on user? Is this even possible?

The application will be deployed in a multi-domain intranet, if that matters (which I assume it does).

Thanks for any help!


Solution

  • You can look up the user's properties in Active Directory. Here is a great article that explains how to do that using System.DirectoryServices and C#:

    http://www.codeproject.com/Articles/6778/How-to-get-User-Data-from-the-Active-Directory