예제 #1
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            try
            {
                ShowLogingError("", true);

                if (WindowsImpersonation.LogonUser(txtUserName.Text, txtDomainName.Text, txtPassword.Text))
                {
                    ShowLogingMsg("Current user:  "******"Login has been made successfully.", true);

                    DirectoryPrepare();
                    this.btnUpload.Disabled = false;
                }
                else
                {
                    ShowLogingError("Authentication failed, check username and password.", false);
                }
            }
            catch (Exception ex)
            {
                ShowLogingMsg("Current user:  "******"Error authenticating. " + ex.Message, false);
            }
        }
예제 #2
0
 protected void Application_AuthenticateRequest(Object sender, EventArgs e)
 {
     WindowsImpersonation.Impersonate();
 }