oga

oga

  • NA
  • 19k
  • 0

web page and Active directory

Jan 10 2006 8:28 PM
I've tried using the Environment class, but the UserName property returns ASPNET, the windows user that started the thread. I've tried other combinations, such as using a WindowsIdentity to populate a WindowsPrincipal object, but with the same end result. I would like to get the %USERNAME% environment variable to transparently identify the current user of an intranet app. I'd like to do this without authenticating the user, as they would already have logged in to our intranet to use their computer. solution? i allways get "ASPNET' user , but in win application I get "Ognjen" ognjen is a logon user, enyone ??????? here is a class that i am using it to get user : using System; using System.Windows.Forms; using System.ComponentModel; namespace SysInfoLib { public class SysInfo : Component { public SysInfo() { } public string UserName() { return SystemInformation.UserName; } } } and then i create a object in web application something like this: SysInfo faca = new SysInfo(); Response.Write(faca.UserName);//here i get a "ASPNET" insted of "Ognjen"