473,799 Members | 2,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CopyDirectory method gives permission error

I am new to .Net programming, but I am experienced with VB6. I am using VB
2008 Express to write a small program to copy a directory structure and files
from a CD to a folder on C: drive.

I have a form with 2 buttons; one to do the copying and one to cancel.

Here is my code for the copying button:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
My.Computer.Fil eSystem.CopyDir ectory("F:\WAFS Blocks - Test",
"C:\HES\WAFS\WA FS Blocks", FileIO.UIOption .AllDialogs)
End Sub

When I click button1, I get an error that says:

............
Application attempted to perform an operation not allowed by the security
policy. To grant this application the required permission, contact your
system administrator, or use the Microsoft .NET Framework Configuration tool.

Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
............

My IT department has no idea what to do about this. They have given my user
account full admin rights with the same results.

What do I need to do to correct this? I need to deploy this on several
systems in several office locations.

Thanks in advance for any help.

Mar 14 '08 #1
5 3042
On Mar 14, 2:58*pm, Patch61 <Patc...@discus sions.microsoft .comwrote:
I am new to .Net programming, but I am experienced with VB6. I am using VB
2008 Express to write a small program to copy a directory structure and files
from a CD to a folder on C: drive.

I have a form with 2 buttons; one to do the copying and one to cancel.

Here is my code for the copying button:

* * Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
* * * * My.Computer.Fil eSystem.CopyDir ectory("F:\WAFS Blocks - Test",
"C:\HES\WAFS\WA FS Blocks", FileIO.UIOption .AllDialogs)
* * End Sub

When I click button1, I get an error that says:

...........
Application attempted to perform an operation not allowed by the security
policy. To grant this application the required permission, contact your
system administrator, or use the Microsoft .NET Framework Configuration tool.

Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
...........

My IT department has no idea what to do about this. They have given my user
account full admin rights with the same results.

What do I need to do to correct this? I need to deploy this on several
systems in several office locations.

Thanks in advance for any help.
I have never used this method, and doubt I ever will now since I have
switched to C#.NET. But, looking as MSDN help, in the list of
exceptions that this method can raise, one is "The Source Directory is
a root directory". Now the remarks does not explicitely mention that
the source direcotyr cannot be the root directory, but it makes one
wonder.
Mar 14 '08 #2
On Mar 14, 8:58*pm, Patch61 <Patc...@discus sions.microsoft .comwrote:
I am new to .Net programming, but I am experienced with VB6. I am using VB
2008 Express to write a small program to copy a directory structure and files
from a CD to a folder on C: drive.

I have a form with 2 buttons; one to do the copying and one to cancel.

Here is my code for the copying button:

* * Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
* * * * My.Computer.Fil eSystem.CopyDir ectory("F:\WAFS Blocks - Test",
"C:\HES\WAFS\WA FS Blocks", FileIO.UIOption .AllDialogs)
* * End Sub

When I click button1, I get an error that says:

...........
Application attempted to perform an operation not allowed by the security
policy. To grant this application the required permission, contact your
system administrator, or use the Microsoft .NET Framework Configuration tool.

Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
...........

My IT department has no idea what to do about this. They have given my user
account full admin rights with the same results.

What do I need to do to correct this? I need to deploy this on several
systems in several office locations.

Thanks in advance for any help.
If you're copying the file over a LAN, having full admin rights will
not help you. Check for sharing / security permissions depending your
operating system.

If it's a local disk, try to copy the same directory manually (copy-
paste) and see if error happens again.
Mar 15 '08 #3
Thank you for replying, but as you can see from my code, neither the source
nor the destination is a root directory.

"za***@construc tion-imaging.com" wrote:
On Mar 14, 2:58 pm, Patch61 <Patc...@discus sions.microsoft .comwrote:
I am new to .Net programming, but I am experienced with VB6. I am using VB
2008 Express to write a small program to copy a directory structure and files
from a CD to a folder on C: drive.

I have a form with 2 buttons; one to do the copying and one to cancel.

Here is my code for the copying button:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
My.Computer.Fil eSystem.CopyDir ectory("F:\WAFS Blocks - Test",
"C:\HES\WAFS\WA FS Blocks", FileIO.UIOption .AllDialogs)
End Sub

When I click button1, I get an error that says:

...........
Application attempted to perform an operation not allowed by the security
policy. To grant this application the required permission, contact your
system administrator, or use the Microsoft .NET Framework Configuration tool.

Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
...........

My IT department has no idea what to do about this. They have given my user
account full admin rights with the same results.

What do I need to do to correct this? I need to deploy this on several
systems in several office locations.

Thanks in advance for any help.

I have never used this method, and doubt I ever will now since I have
switched to C#.NET. But, looking as MSDN help, in the list of
exceptions that this method can raise, one is "The Source Directory is
a root directory". Now the remarks does not explicitely mention that
the source direcotyr cannot be the root directory, but it makes one
wonder.
Mar 15 '08 #4
Thank you for replying. I have tried this with both a network source and a
local source with the same results. I have full admin access/permissions.
"kimiraikko nen" wrote:
On Mar 14, 8:58 pm, Patch61 <Patc...@discus sions.microsoft .comwrote:
I am new to .Net programming, but I am experienced with VB6. I am using VB
2008 Express to write a small program to copy a directory structure and files
from a CD to a folder on C: drive.

I have a form with 2 buttons; one to do the copying and one to cancel.

Here is my code for the copying button:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
My.Computer.Fil eSystem.CopyDir ectory("F:\WAFS Blocks - Test",
"C:\HES\WAFS\WA FS Blocks", FileIO.UIOption .AllDialogs)
End Sub

When I click button1, I get an error that says:

...........
Application attempted to perform an operation not allowed by the security
policy. To grant this application the required permission, contact your
system administrator, or use the Microsoft .NET Framework Configuration tool.

Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
...........

My IT department has no idea what to do about this. They have given my user
account full admin rights with the same results.

What do I need to do to correct this? I need to deploy this on several
systems in several office locations.

Thanks in advance for any help.

If you're copying the file over a LAN, having full admin rights will
not help you. Check for sharing / security permissions depending your
operating system.

If it's a local disk, try to copy the same directory manually (copy-
paste) and see if error happens again.
Mar 15 '08 #5
On Mar 14, 1:58 pm, Patch61 <Patc...@discus sions.microsoft .comwrote:
I am new to .Net programming, but I am experienced with VB6. I am using VB
2008 Express to write a small program to copy a directory structure and files
from a CD to a folder on C: drive.

I have a form with 2 buttons; one to do the copying and one to cancel.

Here is my code for the copying button:

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
My.Computer.Fil eSystem.CopyDir ectory("F:\WAFS Blocks - Test",
"C:\HES\WAFS\WA FS Blocks", FileIO.UIOption .AllDialogs)
End Sub

When I click button1, I get an error that says:

...........
Application attempted to perform an operation not allowed by the security
policy. To grant this application the required permission, contact your
system administrator, or use the Microsoft .NET Framework Configuration tool.

Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
...........

My IT department has no idea what to do about this. They have given my user
account full admin rights with the same results.

What do I need to do to correct this? I need to deploy this on several
systems in several office locations.

Thanks in advance for any help.
Where is the program running? Are you running it from a network
share? Or is the program located on the local hard drive? If running
from a network share, you need to grant trust to the application.

F: looks like a mapped drive. You might try copying using the full
UNC of the path instead of the mapped drive.

Good Luck

Chris
Mar 17 '08 #6

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

Similar topics

3
19186
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
1
2430
by: dwp | last post by:
hResult = pDefaultDomain->CreateInstanceFrom( pAppDomain- >m_bstrLoadAssemblyName, pAppDomain->m_bstrManagedClass, &pObjectHandle ) This call gives the E_ACCESSDENIED return value. I have checked that nothing is using the loaded assembly and that the access rigts are OK. Does anyone know of another reason for this return value ?
1
896
by: vikas.khengare | last post by:
Hi Friends.... I have AJAX code which giving "Permission denied to call method XMLHttpRequest.open" error. This error fired by FireFox 1.0 and IE 6 and with Tomacat 5.x. This code work very correctly on the other machine and giving correct output also. I am trying to fetch "html" pages from others server.
1
7178
by: Jake Barnes | last post by:
I can not figure out the meaning of this error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.bluecasts.com/pdsIncludes/pdsAjax.js :: submitAnyForm :: line 635" data: no] Source File: http://www.bluecasts.com/pdsIncludes/pdsAjax.js Line: 635
4
7203
by: ianyian | last post by:
hi experts, im doing some staff bween th the aspx + MS Word.chellcheck, and and which running on my ypc is no problem ( windows xp , activation by ASPNET ), buts someshow when i try to deploy to server ( windows 2003 ) + IIS 6.0 , hen which giee the error = Object reference not set to an instance of an object.This method or property is not available because a document window is not active. and i have try to configure for the component...
1
25111
by: Charlie | last post by:
I am trying to make an XMLHttpRequest which violates the default "same- origin"policy in Firefox. I checked the archives and found a method that should work but it does not. Below is the test code I isolated. I set signed.applets.codebase_principal_support true and seemed to get the UniversalBrowserRead permission but then the open still failed with the same old "Permission denied to call method XMLHttpRequest.open" error. Can someone tell...
1
2594
by: =?Utf-8?B?bWFnZWxsYW4=?= | last post by:
hi all, I have a button (stopcopy) that I want the user to cancel out of a long file copying operation. I'm not clear what I should "adding" in the sub to make this happen besides & return. I want to stop/cancel the file io operation and return back to the calling form.
1
1578
by: David C | last post by:
I am using VB in my web page. I am using My.Computer.FileSystem.CopyDirectory(strListFolderPath, strCloseFolderPath) to copy one directory and all subdirectories to another location. Is there any other way than using DirectoryExists to make sure the copy succeeded before I delete the source directory? I know that sometimes the file system is slow to recognize an operation. Thanks. David
1
1301
by: codefragment | last post by:
Hi (Second CAS question) At the assembly level I have: at the method level I have
0
9540
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
10475
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
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
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
6805
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
5463
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
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
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.