473,406 Members | 2,217 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,406 software developers and data experts.

Help: I can't delete a file on a mapped network drive using vb.net!

I am trying to make a file sync utillity to sync files between my
laptop and my desktop pc. On my desktop machine (xp pro sp2) I have
shared my "Visual Studio Projects" folder using windows simple file
sharing. And have specified the "Allow network users to change my
files." option as well.

Then on my laptop (xp home sp2) I have mapped a network drive using
windows explorer. So on my laptop I have a Y: drive that points to the
"Visual Studio Projects" folder on my desktop pc.

Here is the test code I am trying to use on my laptop ...

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
Dim file As String
file = "Y:\Visual Studio Projects\Axiom\Axiom.sln"
If IO.File.Exists(file) Then IO.File.Delete(file)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Me.Close()
End Sub

I have made sure that the files I am trying to delete are not read only
and are not being used by another process. But I keep getting a
System.UnauthorizedAccessException being thrown. I have searched
extensivly on the net but have not been able to get a streight answer.
I have also tried using FileIOPermission code from examples I have
found but still can't delete the file(s) on the mapped drive. I have
also tried using the .NET framework tools to give full trust to the
assembly but to no avail.

I should also say that I can delete files from the local machine
(laptop) just fine. For example if I specify

file = "c:\error.txt"

the test app works just fine. I only get a
System.UnauthorizedAccessException when I try to delete a file over a
mapped network drive. Seeing as how the file is on another computer I
am thinking it has to do with "Local Intranet" rules. But when I
trusted the assembly using .net framework tools I specified Full trust
for both "My Computer" and "Local Intranet".

I can also Create/Rename/Read/Write/ and delete files on Y: drive using
windows explorer without any problems.

So what do I need to do, or what code do I need to write to allow my
application to delete a file on a mapped network drive. I'm at my wits
end! I'm beggining to think .NET Framework is being a little to secure!

Nov 21 '05 #1
2 4720
Correction what I meant to say was "I can't delete files on Y: drive
using
windows explorer either"

So how can I give permission to windows explorer to delete a file on a
mapped network drive...

Nov 21 '05 #2
Sounds like a rights issue. You will need to go to the computer that the Y:
drive is mapped to, and set the security as such that you can delete the
files. Usually, you add your domain ID and give it "Full Control". Or, add
"Everyone" and give that group Full Control....if everyone is trusted that
is...
<cr********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Correction what I meant to say was "I can't delete files on Y: drive
using
windows explorer either"

So how can I give permission to windows explorer to delete a file on a
mapped network drive...

Nov 21 '05 #3

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

Similar topics

2
by: Pola | last post by:
Please Help I am using VC++.NET In my appl I have to disable access to some disks in the network How I can do it thank you Pol
6
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004...
2
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
2
by: lastusernameleft | last post by:
Is there a .NET method for doing this? I haven't found anything else that works. Thanks
2
by: Michal Valent | last post by:
Hello, if I try to read a file on the mapped network drive, this error apears: Logon failure: unknown user name or bad password. How to set up permissions for IUSR_MACHINENAME on the mapped...
14
by: Adrian Parker | last post by:
For deployment reasons, we don't want to have to install our large app on each network client manually; we'd like to have our users run a very small app on their clients that basically runs the main...
2
by: Duy Vu | last post by:
Hi all, I'm using VB.Net 2003 to write a small program to display images in PictureBox1: Dim filePath As String Dim fileName As String ......... .... Do some stuff to get filePath and...
2
by: Mike | last post by:
Can a vb program running as a serice not use network paths to do file/io? I can't seem to get my program to work with network paths and files. When I use local disk it works fine. When I run it...
5
by: Saabster | last post by:
Hi all, I'm fairly new to VB.NET but have more experience with VB6 and earlier. I'm trying to create an application that will move files from one folder to another. Here is the scenario. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.