25 Temmuz 2011 Pazartesi

Etki alanı (Domain) içinde Giriş Yapılmış Kullanıcı Adını ve Etki Alanı Adını Elde Etmek / How to get current user name and domain name

if (!Page.IsPostBack)

{

string windowsIdentityName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

string[] domainVeKullanici = windowsIdentityName.Split('\\');

windowsIdentityName = domainVeKullanici[domainVeKullanici.Length - 1];

       if (windowsIdentityName == "turbo.sadik")

       {

                        KullaniciAdTextBox.Text = "tsadik@domain.com";

                        PwdTextBox.Text = "sadik123";

                        LoginButton_Click(sender, e);

       }

}

 

Hiç yorum yok:

Yorum Gönder