Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
 protected void Application_AuthenticateRequest(Object sender, EventArgs e)
 {
     WindowsImpersonation.Impersonate();
 }