AuthenticationService, BusinessApplicationTemplate.
[EnableClientAccess]
public class AuthenticationService : AuthenticationBase<User> {
protected override User GetAuthenticatedUser(System.Security.Principal.IPrincipal principal)
{
User user = base.GetAuthenticatedUser(principal);
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
SystemWebSectionGroup grp = (SystemWebSectionGroup)config.GetSectionGroup("system.web");
AuthenticationSection auth = grp.Authentication;
if (auth.Mode == AuthenticationMode.Forms)
{
}
else if (auth.Mode == AuthenticationMode.Windows)
{
string[] a = user.Name.Split('\\');
System.DirectoryServices.DirectoryEntry ADEntry = new System.DirectoryServices.DirectoryEntry("WinNT://" + a[0] + "/" + a[1]);
string Name = ADEntry.Properties["FullName"].Value.ToString();
user.Name = Name;
}
return user;
}
}