登录失败,用户名未知或密码错误 [英] Logon failure unknown username or bad password

查看:326
本文介绍了登录失败,用户名未知或密码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用模拟(< username,password>)将文件从PC复制到服务器.
当我编写以下代码并运行该代码时,抛出了登录失败,未知用户名或密码错误"的异常.
有人可以帮忙吗?

I want to copy a file from a pc to a server using impersonate (<username,password>).
When I wrote the follwing code and run it exception was thrown "logon failure unknown username or bad password".
Can anyone help?

using (new Tools.Impersonator(Serv_UName, "",Serv_Pwd))
{
    if (File.Exists(DestFileName))
    {
        MessageBox.Show("already exists in destination");
        return 1;
    }
    else
    {
        File.Copy(Src_FileName, DestFileName, true);
        return 0;
    }
}

推荐答案

请参阅以下文章

使用C#的Windows模拟 [ http://en.wikipedia.org/wiki/Windows_domain [ http://www.networkclue.com/os/Windows/AD/index.aspx [ ^ ]

如果其他所有方法都不成功

http://www.google.com/search?q=understanding+domains+windows [ ^ ]
See the following article

Windows Impersonation using C#[^]

You may need to read up on domains....


http://en.wikipedia.org/wiki/Windows_domain[^]

http://www.networkclue.com/os/Windows/AD/index.aspx[^]

If all else fails

http://www.google.com/search?q=understanding+domains+windows[^]


您看到的错误消息非常清楚-您尚未提供可以正确进行身份验证的凭据.

您说您正在连接到服务器-那么您希望使用哪个帐户对服务器进行身份验证?服务器上的域帐户还是本地帐户?

您提供的参数是

The error message you are seeing is pretty clear - you haven''t provided credentials that it can correctly authenticate with.

You say you are connecting to a server - so what account are you expecting to use to authenticate against the server? A domain account, or a local account on the server?

The arguments you are providing are

Serv_UName, "",Serv_Pwd



什么是中间论点?是域"吗?如果是这样,请尝试以下



What is the middle argument? Is it ''domain''? If so, try the following

Serv_UName, Serv_Name, Serv_Pwd



因此,如果我想使用帐户dmorley连接到名为SERVER1的服务器,它将显示为



So if I wanted to connect to a server called SERVER1 with account dmorley, it would read

using (new Tools.Impersonator("dmorley", "SERVER1", "S0mePa55word"))



您需要确保该帐户在您要连接的服务器上存在



You need to make sure that the account exists on the server you are connecting to


这篇关于登录失败,用户名未知或密码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆