c# - Unkown username or bad password error accessing shared drive from IIS -
i trying read files shared drive. share password protected first using net use command access share , reading files.
here net use command using:
net use "\server\share\folder name" /u:"domain\username" "password"
this working fine when debugging vs2010. once published iis 6 though, started giving me error: login failure: unkown username or bad password.
i've read alot , seems issue comes accounts not matching up. running service under aspnet account (annonymous authentication enabled) can't see why should make difference being passing username , password through net use command.
i bit lost how works if can clarify, i'd appreciate it. tia!
few month ago similar problem. found library on net can use resolved issue.
search "pinvokewindowsnetworking" cs file on google , code it's simple using it
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 file , directory access pinvokewindowsnetworking.disconnectremote(v_directoryname.directoryname);
Comments
Post a Comment