|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
accessing network drivehey everyone,
i try to access a network drive using asp.net: File.Delete(@"W:\text.txt"); but i get this error message: System.IO.DirectoryNotFoundException: Could not find a part of the path 'W:\text.txt'. i setup impersonate in the web.config: <identity impersonate="true" userName="user" password="password" /> but it still doesnt work. this user has access to the network drive. i can access it using windows explorer. do i have to impersonate this user in the code and then access the drive? found the answer:
File.Delete(@\\servername\folder\text.txt); this works fine. does anyone know why the other method failed Show quoteHide quote "Abraham Andres Luna" <a**@rdk.com> wrote in message news:O7XJJSN0FHA.560@TK2MSFTNGP12.phx.gbl... > hey everyone, > > i try to access a network drive using asp.net: > > File.Delete(@"W:\text.txt"); > > but i get this error message: > > System.IO.DirectoryNotFoundException: Could not find a part of the path > 'W:\text.txt'. > > i setup impersonate in the web.config: > > <identity impersonate="true" userName="user" password="password" /> > > but it still doesnt work. this user has access to the network drive. i can > access it using windows explorer. do i have to impersonate this user in > the code and then access the drive? > "Abraham Andres Luna" <a**@rdk.com> wrote in message Er, because the webserver doesn't have a mapped W: drive...?news:ex0$PZN0FHA.2212@TK2MSFTNGP15.phx.gbl... > found the answer: > > File.Delete(@\\servername\folder\text.txt); > > this works fine. does anyone know why the other method failed i do have the drive mapped
i can use windows explorer and under my computer i have a W: that is mapped to \\servername\folder Show quoteHide quote "Mark Rae" <m***@mark-N-O-S-P-A-M-rae.co.uk> wrote in message news:uY1asJO0FHA.464@TK2MSFTNGP15.phx.gbl... > "Abraham Andres Luna" <a**@rdk.com> wrote in message > news:ex0$PZN0FHA.2212@TK2MSFTNGP15.phx.gbl... > >> found the answer: >> >> File.Delete(@\\servername\folder\text.txt); >> >> this works fine. does anyone know why the other method failed > > Er, because the webserver doesn't have a mapped W: drive...? > "Abraham Andres Luna" <a**@rdk.com> wrote in message Yes, but does your webserver...?news:%239qHKrP0FHA.2932@TK2MSFTNGP10.phx.gbl... >i do have the drive mapped When you do anything with a mapped drive, it actually is looking up the
directory with your default built-in "ASPNET" local account in that machine. By default, that account has no access to the network drive and the only way to do it is to change that in the machine.config file.
Looking for good ASP.NET C# books
assignment between jscript variables in a codebehind-created jscri Which to use VB.NET or C#? Browser is redirecting automatically to some unknown page what's a neater way of writing this simple code... SO DAM SICK of this error tips on how to produce a 'partitioned' datalist/datagrid Panel in Table with overflow problem with firefox how best to organize project Old question but not finished yet : sessions |
|||||||||||||||||||||||