473,657 Members | 2,806 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(Remot eFolder, MoveImportedFil esTo);

where
RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
and
MoveImportedFil esTo = 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 7717
"roger_27" <ro*****@discus sions.microsoft .comwrote in message
news:30******** *************** ***********@mic rosoft.com...
hey, I've seen this problem many times over the net, and now I'm one of
them.
simple code really.

File.Move(Remot eFolder, MoveImportedFil esTo);

where
RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
and
MoveImportedFil esTo = 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*****@discus sions.microsoft .comwrote in message
news:30******** *************** ***********@mic rosoft.com...
hey, I've seen this problem many times over the net, and now I'm one of
them.
simple code really.

File.Move(Remot eFolder, MoveImportedFil esTo);

where
RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
and
MoveImportedFil esTo = 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*****@discus sions.microsoft .comwrote in message
news:30******** *************** ***********@mic rosoft.com...
hey, I've seen this problem many times over the net, and now I'm one of
them.
simple code really.
>
File.Move(Remot eFolder, MoveImportedFil esTo);
>
where
RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
and
MoveImportedFil esTo = 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 a drive but I still get the same error. System.UnauthorizedAccessException: Access to the path "M:\home.wav" is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.File.Move(String sourceFileName, String...
2
1298
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 network to various project folders and enumerates the files within. When clicked on, the file is retrieved and streamed back across the network to the webserver and then back to the requestor. All of this works great; however, since the original...
2
2053
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 System.IO.File.Move but get the message "Could not find a part of the path". The path to the receiving directory is mapped. I get the same message independant of receiving computer
1
3048
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 code where I do the file.move is taking a very long time (in the order of around 7 seconds for a simple 30kb file). The only thing that I can think may be causing the problem is that theere is around 1.1 million files to move, so perhaps it's the
1
2238
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 version. I have a problem, however, when I do the first check using reflection to get the network version, then it locks the file and I can't delete it. How long will the program maintain a lock on the file using reflection? I am setting the...
4
3900
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. However, the user wants to download and edit a file and then upload the same file back to the database (ie overwrite the file). How do I do this? Also, how to upload/download the file to a network drive instead of
1
64094
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 article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
12
4708
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 File.Delete() will be sufficient. Is there anything in .NET that removes any remanence of the file? If it isn't going to be easy, does anyone know of a component that I can hook into to do the dirty work, free of otherwise?
0
8316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4168
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.