473,503 Members | 9,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

the dreaded File.Move over network problem...

hey, I've seen this problem many times over the net, and now I'm one of them.
simple code really.

File.Move(RemoteFolder, MoveImportedFilesTo);

where
RemoteFolder = \\192.168.1.99\ftp2users\monday\original1.csv
and
MoveImportedFilesTo = C:\wow.csv

all I get is "Access to the path is denied." . I dont get it. I'm not only a
local, but a network admin, and I specifically gave my user FULL CONTROL over
the directory.

I'm doing this in a windows service.

any ideas what else I could be missing here?
Aug 18 '08 #1
3 7691
"roger_27" <ro*****@discussions.microsoft.comwrote in message
news:30**********************************@microsof t.com...
hey, I've seen this problem many times over the net, and now I'm one of
them.
simple code really.

File.Move(RemoteFolder, MoveImportedFilesTo);

where
RemoteFolder = \\192.168.1.99\ftp2users\monday\original1.csv
and
MoveImportedFilesTo = C:\wow.csv

all I get is "Access to the path is denied." . I dont get it. I'm not only
a
local, but a network admin, and I specifically gave my user FULL CONTROL
over
the directory.

I'm doing this in a windows service.

any ideas what else I could be missing here?

The key is that you're doing the file move in a service. By default,
Windows runs services under the LocalSystem account, which doesn't have
network access. You need to change the service account to an account that
has network access.

Mike Ober.
Aug 18 '08 #2
but that's the thing, I am a network administrator, and that folder has
permissions for administrators to have full control

"Michael D. Ober" wrote:
"roger_27" <ro*****@discussions.microsoft.comwrote in message
news:30**********************************@microsof t.com...
hey, I've seen this problem many times over the net, and now I'm one of
them.
simple code really.

File.Move(RemoteFolder, MoveImportedFilesTo);

where
RemoteFolder = \\192.168.1.99\ftp2users\monday\original1.csv
and
MoveImportedFilesTo = C:\wow.csv

all I get is "Access to the path is denied." . I dont get it. I'm not only
a
local, but a network admin, and I specifically gave my user FULL CONTROL
over
the directory.

I'm doing this in a windows service.

any ideas what else I could be missing here?


The key is that you're doing the file move in a service. By default,
Windows runs services under the LocalSystem account, which doesn't have
network access. You need to change the service account to an account that
has network access.

Mike Ober.
Aug 19 '08 #3
problem fixed. here was the problem:

the SOURCE filename had the path AND filename
the DESTINATION had only the PATH. needed the filename too.

When you try to write using the textwriter to a FOLDER (as opposed to a
file) you get "The given path's format is not supported". but I guess in this
exact same problem, but with File.Move, you get "Access is denied". I think
that's a rather misleading error. add to that that the intellisense says for
the destination parameter "The New Path of the file" rather than "The new
path and name of the file" and you can see how such a minute error could
happen.

but whatever. it's fixed!

"roger_27" wrote:
but that's the thing, I am a network administrator, and that folder has
permissions for administrators to have full control

"Michael D. Ober" wrote:
"roger_27" <ro*****@discussions.microsoft.comwrote in message
news:30**********************************@microsof t.com...
hey, I've seen this problem many times over the net, and now I'm one of
them.
simple code really.
>
File.Move(RemoteFolder, MoveImportedFilesTo);
>
where
RemoteFolder = \\192.168.1.99\ftp2users\monday\original1.csv
and
MoveImportedFilesTo = C:\wow.csv
>
all I get is "Access to the path is denied." . I dont get it. I'm not only
a
local, but a network admin, and I specifically gave my user FULL CONTROL
over
the directory.
>
I'm doing this in a windows service.
>
any ideas what else I could be missing here?
>

The key is that you're doing the file move in a service. By default,
Windows runs services under the LocalSystem account, which doesn't have
network access. You need to change the service account to an account that
has network access.

Mike Ober.

Aug 19 '08 #4

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

Similar topics

2
464
by: Bill Young via .NET 247 | last post by:
I'm having all sorts of problems trying to move a file across the network using the File.Move command with a computer on the network. I have tried doing it with \\<server>\<share> and I tried mapping...
2
1292
by: MWells | last post by:
I have a simple project server which shares files from within our network. The ASP.NET front end uses a database to authenticate users, and then based on their permissions, reaches across the...
2
2043
by: Eje | last post by:
I have a webapplication on a server. One function is to build txt-files. These files should then be moved to a fixed directory on another computer in the company network. I have tried to use...
1
3038
by: Matthew Eno | last post by:
I have a problem where I'm developing some code that moves files from one place to another (on the same drive) with the destination file having a new name. What's happening is that the line of...
1
2233
by: John Wright | last post by:
During my program I load an exe file using reflection. My program loads the file using reflection, checks the assembly version and does an update if the network version is different from the local...
4
3886
by: abhanjee | last post by:
Hello, I am a newbie and am developing an application for work. I have figured out how to upload a file attachment to the SQL database and download the same file using C# and Visual Studio....
1
64004
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
12
4685
by: glennanthonyb | last post by:
Hi The company I work for has finally woken up to data security on our field laptops. I'm writing something in C# that will allow remote deletion of sensitive data and I don't believe...
0
7207
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
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
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
7470
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...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.