简体   繁体   English

从IIS访问共享驱动器的用户名未知或密码错误错误

[英]Unkown username or bad password error accessing shared drive from IIS

I am trying to read files from a shared drive. 我正在尝试从共享驱动器读取文件。 The share is password protected so I am first using a net use command to access the share and then reading the files. 共享受密码保护,因此我首先使用net use命令访问共享,然后读取文件。

Here is the net use command I am using: 这是我正在使用的net use命令:

net use "\\server\\share\\folder name" /u:"domain\\username" "password" 净使用“ \\ server \\ share \\ folder name” / u:“ domain \\ username”“ password”

This was all working fine when debugging from VS2010. 从VS2010调试时,一切都正常。 Once I published to IIS 6 though, it started giving me an error: Login Failure: Unkown username or bad password. 但是,一旦我发布到IIS 6,它就会开始给我一个错误:登录失败:用户名未知或密码错误。

I've read up alot about this and it seems that this issue comes mostly from the accounts not matching up. 我已经阅读了很多有关此内容的内容,看来该问题主要来自于不匹配的帐户。 I am running my service under ASPNET account (annonymous authentication is enabled) but I can't see why this should make a difference being that I am passing a username and password through the net use command. 我在ASPNET帐户下运行我的服务(启用了匿名身份验证),但是我看不到为什么要通过net use命令传递用户名和密码来产生区别。

I am a bit lost with how this all works so if anyone can clarify, I'd really appreciate it. 我对这一切的工作方式有些迷惑,所以如果有人可以澄清的话,我将不胜感激。 TIA! TIA!

few a month ago i was the similar problem. 几个月前,我遇到了类似的问题。 I found a library on the net that you can use for resolved your issue. 我在网上找到了一个图书馆,可以用来解决问题。

Search "PInvokeWindowsNetworking" cs file on google and now my code it's very simple to using it 在Google上搜索“ PInvokeWindowsNetworking” cs文件,现在我的代码使用起来非常简单

string v_DirectoryName = .... //Your Network directory
    PinvokeWindowsNetworking.connectToRemote(v_DirectoryName.DirectoryName, ConfigurationManager.AppSettings["TransmissionDirectoryLogin"], ConfigurationManager.AppSettings["TransmissionDirectoryPassword"]);
        DirectoryInfo v_Directory = new DirectoryInfo(v_DirectoryName);
        ....//Manage your file and directory access
    PinvokeWindowsNetworking.disconnectRemote(v_DirectoryName.DirectoryName);

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

相关问题 在IIS上运行网站时存储到共享网络驱动器时出错 - Error while storing to a shared network drive when running website on IIS request.getresponse()给出错误的错误用户名和密码 - request.getresponse() giving error bad username and password 从iis上托管的Web应用程序读取/写入共享驱动器中的文件 - Read/write files in shared drive from web application hosted on iis 通过ASP网站访问VFS共享网络驱动器并查看其中的文件,可能是IIS错误 - Accessing a VFS shared network Drive through ASP Website and Viewing the files inside, Possible IIS fault smtp客户端并从配置代码访问用户名和密码 - smtp client and accessing username and password from configuration code C# PrincipalContext 在 IIS 上没有用户名和密码 - C# PrincipalContext without username and password on IIS 如何使用特定的用户名和密码启动IIS进程 - How to start a IIS process with specific username & password iis7集成了windowsauthentication,提示输入用户名和密码 - iis7 integrated windowsauthentication prompts for username and password AD身份验证未知的用户名或密码错误 - AD Authentication Unknown username or bad password 访问共享的网络驱动器时需要模拟 - Need Impersonation when accessing shared network drive
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM