Computing.Net > Forums > Programming > .VB.NET Security permissions

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

.VB.NET Security permissions

Reply to Message Icon

Name: VASS
Date: November 3, 2004 at 19:57:49 Pacific
OS: WIN XP PRO
CPU/Ram: 1GB
Comment:

Hello everybody. I am having a bit of a problem with VB.NET. I am trying to copy a file from the server to the local PC but i get the following error:

****start of error message ***************
The application attempted to perform an operation not allowed by the security policy <bla bla bla>

Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.
******* end of error message **************

My code is the following:
*****************************************
Dim SourceFile, DestinationFile As String
Dim test As String
Dim sFileInfo As IO.FileInfo
Dim fileIOPerm1 As FileIOPermission

'fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.AllAccess, "c:\fileToBeCopied.exe")
'fileIOPerm1.Demand()

Dim f As New FileIOPermission(PermissionState.Unrestricted, "c:\fileToBeCopied.exe")
f.AllLocalFiles = FileIOPermissionAccess.AllAccess


PgbCopying.Minimum = 0
sFileInfo = New System.IO.FileInfo("j:\fileToBeCopied.exe") 'j is the server
test = sFileInfo.Length
PgbCopying.Maximum = test
SourceFile = "j:\fileToBeCopied.exe" ' Define source file name.
DestinationFile = "c:\fileToBeCopied" ' Define target file name.
FileCopy(SourceFile, DestinationFile) ' Copy source to target.
PgbCopying.Value = PgbCopying.Value + test
Timer1.Enabled = False
End

****** END OF CODE ****************
So i am trying to copy the FileToBeCopied from the J Drive to the C Drive, and while in my computer all are OK, when i go to another one i get this message. At first I used the demand command with the same result. Then i comment it out and tryed PermitionState. Nothing.Any help? Thank you...




Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: November 4, 2004 at 06:31:06 Pacific
Reply:

I don't know if it is a programming issue. It might be that the computer where you get the error does not have those permissions on the target computer.

Are you logged into the network on the computer using an account that has those permissions on the target computer?

You might want to check the permissions on the source and target drives and folders.

I hope this helps some.

Chi

"They mostly come at night...mostly"


0

Response Number 2
Name: VASS
Date: November 4, 2004 at 19:09:43 Pacific
Reply:

Hello Chi,

I gave full permissions to the user for the directory where the file is, but still nothing. If I use VB6 I don't have that problem.

The user is logging in as "User" and not as "Administrator" as I do. Is that has anything to do with that? Like I said I have given him full rights.

Thank you for your reply. I am still trying to find a solution...


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: .VB.NET Security permissions

How do I hide a form on load vb.net www.computing.net/answers/programming/how-do-i-hide-a-form-on-load-vbnet/4597.html

Vb .net www.computing.net/answers/programming/vb-net/13338.html

Vb.net www.computing.net/answers/programming/vbnet/4055.html