c# - Can't access mapped network drive -




i have consoleapp (not asp.net) takes files directories (the app runs on windows server 2012). app works fine local dirs , shared dirs (ex. "\\myshare\dest"). however, when map share (from "\\myshare x:)

directorynotfoundexception.

i have map drive because of files exceeding 260 letters limit. furthermore, when debug app on pc, don't error while accessing mapped drive.

thanks in advance :)

p.s: i've seen other posts problem app doesn't run right user privileges. app runs credentials map exists user..

edit: did little workaround , worked. instead of creating mapped network drive used mklink command , made shortcut share:

mklink /d c:\myshortcut \\myshare

thanks everyone

if understood question , comments correctly, mapped drive cannot accessed mapping not visible application. understanding possible programmatically connect share using platform invoke, more precisely following 2 functions , structure.

[dllimport("mpr.dll")] static extern int wnetuseconnection(     intptr hwndowner,     netresource lpnetresource,     string lppassword,     string lpuserid,     int dwflags,     string lpaccessname,     string lpbuffersize,     string lpresult );  [dllimport("mpr.dll")] static extern int wnetcancelconnection2(     string lpname,     int dwflags,     bool fforce );  [structlayout(layoutkind.sequential)] class netresource {      public int dwscope = 0;     public int dwtype = 0;     public int dwdisplaytype = 0;     public int dwusage = 0;     public string lplocalname = "";     public string lpremotename = "";     public string lpcomment = "";     public string lpprovider = ""; } 

the functions documented here , here; this , this question possibly related.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -