简体   繁体   English

登录失败:用户名未知或密码错误

[英]Logon failure: unknown user name or bad password

I have been struggling with this problem for hours now. 我已经为这个问题苦苦挣扎了几个小时。 I have an web app that works with Active Directory Authentication. 我有一个与Active Directory身份验证一起使用的Web应用程序。 Only certain people are allowed to upload files to the server. 仅允许某些人将文件上传到服务器。 When I test from my localhost everything works fine and I can upload files to the correct path on the server. 当我从本地主机进行测试时,一切正常,可以将文件上传到服务器上的正确路径。 When I publish my solution to the server and I run it from there, it gives me the error "Logon failure: unknown user name or bad password". 当我将解决方案发布到服务器并从那里运行时,出现错误“登录失败:未知的用户名或密码错误”。 I have set the permissions on the folder for myself to Full Control and Allow All. 我已将自己文件夹的权限设置为“完全控制”和“全部允许”。 The server is running IIS 6. Can some one please advise on what to do. 该服务器正在运行IIS6。请问有人可以做什么。 I have tried literally almost everything. 我几乎尝试了所有事情。

Server is on a different machine. 服务器在另一台计算机上。 Local is on my PC.; 本地在我的PC上。

if (this.flUpload.HasFile)
                        {
                            flUpload.SaveAs(@"SERVERPATH\" + flUpload.FileName);
                        }

Please try below. 请尝试以下。

  NetworkCredential myCred = new NetworkCredential(GlobalVariablesBO.UserID, GlobalVariablesBO.Password, GlobalVariablesBO.Domain);
            WebClient webclient = new WebClient();
            webclient.Credentials = myCred;
            string tempFileForStorage = Path.Combine(Path.GetTempPath(), Path.GetFileName(dBO.SPFileName));
            sharepointUpload.SaveAs(tempFileForStorage);
            webclient.UploadFile("ServerPath", "PUT", tempFileForStorage);
            webclient.Dispose();
            File.Delete(tempFileForStorage);

It looks like more of configuration issue . 看起来更多是配置问题。 Make sure that Website hosting server IIS User should have read/write permission to the server where you are uploading files . 确保网站托管服务器IIS用户应该对要上传文件的服务器具有读/写权限。

Please try below code and see if the file is geeting sabed in tempFileForStorage location. 请尝试以下代码,并查看文件是否在tempFileForStorage位置被保存。 This path is C://Temp 此路径为C:// Temp

  if (this.flUpload.HasFile)
                    {
                     string tempFileForStorage = Path.Combine(Path.GetTempPath(), flUpload.FileName
                        flUpload.SaveAs(tempFileForStorage);
                    } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 StreamWriter引发IOException登录失败:用户名未知或密码错误 - StreamWriter throws IOException Logon failure: unknown user name or bad password 登录失败:用户名未知或密码错误? 但是我使用正确的用户名和密码 - Logon failure: unknown user name or bad password? But I am using the right username and password 登录失败:用户名未知或密码错误。访问其他服务器时出错 - Logon failure: unknown user name or bad password.error while accessing other server 登录失败:在远程计算机中创建文件夹时,用户名未知或密码错误 - Logon failure: unknown user name or bad password while creating folder in remote machine 登录失败:用户名未知或密码错误。 使用C#的FTP - Logon failure: unknown user name or bad password. FTP with C# UNC LogonUser:未知用户或密码错误 - UNC LogonUser: Unknown user or bad password 登录失败:未在此计算机上为用户授予请求的登录类型 - Logon failure: the user has not been granted the requested logon type at this computer 更新Active Directory用户登录名域 - Updating Active Directory User Logon Name Domain AD身份验证未知的用户名或密码错误 - AD Authentication Unknown username or bad password 交互式登录:提示用户在到期前更改密码 - Interactive logon: Prompt user to change password before expiration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM