C
createdbyx
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!
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!