473,699 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copying a file to a network share, take 2

Hello, my app needs to copy a file on a network share. The network
share is accessible via a domain ID, which has all possible folder
rights assigned to it. I am using the impersonation code from here

http://msdn.microsoft.com/library/de...asp?frame=true

The code seems to properly impersonate (as evidenced by debug
statements), however, when I do this:

Dim sSource As String =
"\\nasrv88c3\mo deldev$\modelde v\apps\web_inv\ stmtstemp\MBS
Staging\ObjectL ist2.zip"
Dim sTarget As String =
"\\nasrv88c3\mo deldev$\modelde v\apps\web_inv\ stmtstemp\MBS
Staging\ObjectL ist.zip"

Try
File.Copy(sSour ce, sTarget)
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try

It fails with "System.Io.File NotFoundExcepti on: Could not find the
file..." I know for sure that the file is there. Do I first perhaps
have to log on to the share? If so, are there any examples out there?
What am I missing in general?

Thank you
Nov 21 '05 #1
0 1334

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

Similar topics

3
3646
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
0
1579
by: surya | last post by:
Hi, I need to enable shadow copying network share folder assemblies. Currently if the path is given as the network share folder path, shadow copying is not enabled. Should something special be done to enable shadow copying of files on network share folders? Thanks in advance, Regards Surya
8
17035
by: Ram Baruch | last post by:
Hi, I'm trying to use the File.Copy() function. It works well when the desenation file is local (Like: C:\dest\dest.exe). The problem is that when I'm trying to copy to a destenation that starts with '\\' it doesnt work and exception is thrown (for example: \\MyComputer\DestDirectory). Even if the first and the second directories are actually the same- the File.Copy() doesn't work. Is there any way to copy a file to a different computer?...
8
11847
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve, and use @"C:\file.txt"; it worked Thanks a lot
2
2181
by: Frank Rizzo | last post by:
Hello, my app needs to copy a file from local TEMP folder to network share. The network share is accessible via a domain ID. I am trying to call LogonUser API, then ImpersonateLoggedOnUser, then copy the file to this share. But I keep on getting errors. Even though all the APIs return success, copying files still comes back with "Access denied" type of errors. Am I missing something here? Thanks
0
803
by: Frank Rizzo | last post by:
Hello, my app needs to copy a file on a network share. The network share is accessible via a domain ID, which has all possible folder rights assigned to it. I am using the impersonation code from here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSecurityPrincipalWindowsImpersonationContextClassTopic.asp?frame=true The code seems to properly impersonate (as evidenced by debug statements),...
4
3130
by: Sue | last post by:
Hello We have an application where the user would upload files (max size of 200 mb) from their client machine. This application will run on a web server (its a web server which would be used by the general public), because of obvious reason, this server will not have access to any shared directory on the network. Currently we store the file on the local drive (c:) of that server and an other application running on an internal server...
0
1737
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, We have a legacy asp application that uses a third party component to upload a file and saves it to a secure network share. The code sets the credentials for the secure network share on the third party component. I want to do something similar from C# code and save a file to the secure network share by setting the credentials to access the network share in code rather than running the C# code under the user account that has access...
0
2040
by: cw808 | last post by:
Hi all. I'm new here but hoping I can get some help for my problem. My situation is that I need to upload files through a C# .NET web application to a file server. I done a search and followed some advice on how to set it up. My environment is Windows 2003 file server, Windows 2000 web service (IIS) and .NET v1.1.4. So far I've done this. Windows 2003 file server: Created an account SHAREUSER. Created a share MEDIA. SHAREUSER is...
0
8613
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
9172
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
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
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...
1
6532
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
5869
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
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
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2008
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.