473,395 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

accessing network drive

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?
Nov 19 '05 #1
5 1918
found the answer:

File.Delete(@\\servername\folder\text.txt);

this works fine. does anyone know why the other method failed

"Abraham Andres Luna" <ab*@rdk.com> wrote in message
news:O7*************@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?

Nov 19 '05 #2
"Abraham Andres Luna" <ab*@rdk.com> wrote in message
news:ex**************@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...?
Nov 19 '05 #3
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

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:uY*************@TK2MSFTNGP15.phx.gbl...
"Abraham Andres Luna" <ab*@rdk.com> wrote in message
news:ex**************@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...?

Nov 19 '05 #4
"Abraham Andres Luna" <ab*@rdk.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
i do have the drive mapped


Yes, but does your webserver...?
Nov 19 '05 #5
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.

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
1
by: Z0gS | last post by:
I got this problem for the web application I try to access files on a remote server. string dirs = Directory.GetDirectories(@"E:\vehicles") E drive is a map to a network drive. I get the...
1
by: Max Baki via .NET 247 | last post by:
I all, i've write a sample ftp Windows service which download files and copy them on remote share or remote mapped drive (the service works fine on local drives). This part of code is the...
3
by: Bonj | last post by:
I need to write a windows service, and the only way it can access a shared drive on a file server on the network is if the installer is put in "User" mode - "LocalService", "LocalSystem" and...
1
by: mbah Sumani via .NET 247 | last post by:
(Type your message here) I Think it's the stupidness of Windows. Why the service can't access network drive but console apps or windows application can do it? So my suggestion is make the program...
2
by: Ian Murrell | last post by:
My application writes a text data file to a folder on another computer. The other computer is mapped by drive letter to the root (C) shared folder, eg as G:. The network is simple peer2peer, shared...
3
by: dotnettester | last post by:
Hi, I'm trying to read a network drive through ASP.net. This is what I have done. - Create folder on a network machine. - gave ASPNET_User read permssion on the folder. - Mapped a drive to the...
8
by: Ben Fidge | last post by:
Hi I have a small WinForms app that needs to copy files from a shared drive on a network. If I connect to the mapped drive using Explorer, a password dialog pops-up and I have to provide...
2
by: Roka | last post by:
Hi all I have a problem when I tried to use fopen on a shared network drive .. (OS is Windows 2000svr) It is said fopen failed . Can anyone tell me how to do fopen on a network drive or network...
1
by: martin lanny | last post by:
My application should periodically connect to multiple network drives to see if the certain files were created. I would do this to retrieve the list of files in UNC path //server1/backup/: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.