Re: Newbie question about permissions on network folder
- From: Chris <no@xxxxxxxx>
- Date: Tue, 16 Aug 2005 00:43:26 -0400
Claudio Gomes wrote:
Hi,
I'm trying to run a pretty simple code to rename a set of files located on a network folder I have access to. When I run this from a local disk it works fine. But when I copy the .EXE to the network and try to run the program from there it comes back with the following exception message:
Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed
I tried adding the following code:
*-----------------------------------
Dim f As New FileIOPermission(PermissionState.None)
f.AddPathList(FileIOPermissionAccess.AllAccess, "F:\my network folder")
*-------------------------------------
but it made no difference.
The troublesome code goes below:
*------------------------------
Private Sub ChangeFileName(ByVal strFrom As String, ByVal strTo As String, ByRef di As DirectoryInfo, _
ByRef lblStatus As Label)
Dim entries() As FileSystemInfo Try entries = di.GetFileSystemInfos(strFrom)
If entries.Length = 1 Then
File.Move(txtPath.Text & entries(0).Name, txtPath.Text & strTo)
lblStatus.Text = "Done"
lblStatus.Visible = True
Else
MsgBox("There was more/less than one file to be renamed from " & strFrom, MsgBoxStyle.OKOnly)
lblStatus.Text = "Unable"
lblStatus.Visible = True
End If
Catch ex As Exception
MsgBox("There was a problem trying to access the directory " & txtPath.Text & vbCrLf & _
"The message was: " & vbCrLf & ex.Message, _
MsgBoxStyle.OKOnly & MsgBoxStyle.Exclamation)
lblStatus.Text = "Unable"
lblStatus.Visible = True
End Try
End Sub
You are having issues with security. If you goto Accessories -> Dot Net Security Wizard you can adjust you the settings for your app. Put it fully trusted and you'll see that it works. If you need to depoly this app you'll have to look into security profiles and such for deploying your app.
Good luck Chris .
- Follow-Ups:
- Re: Newbie question about permissions on network folder
- From: Claudio Gomes
- Re: Newbie question about permissions on network folder
- References:
- Newbie question about permissions on network folder
- From: Claudio Gomes
- Newbie question about permissions on network folder
- Prev by Date: how to monitot that an aoolication as NOT started as scheduled.
- Next by Date: Re: how to monitot that an aoolication as NOT started as scheduled.
- Previous by thread: Newbie question about permissions on network folder
- Next by thread: Re: Newbie question about permissions on network folder
- Index(es):
Relevant Pages
|