Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All
I am new in C#, i create a directory using visual studio C# 2008. using Directory.Create function it works fine in windows xp. but failed in widows 7. i have a error message while run in windows7 the error message is access path denied. any one help me please
regards
ak.naser
Posted
Updated 18-Dec-11 18:23pm
v2

It's a access permisson issue. if you create directory on C:\. This is protected (by design) in Vista and Windows 7 (and Windows Server 2008 / 2008 R2) - normal user accounts do not have any permission to create directories in there
You need to login with Administrator and then try your code.
 
Share this answer
 
As the others have said, this comes down to a permissions problem. The user that the code is running as does not have permissions to create a folder in the folder that you are trying to do this. Normal user account cannot create folders anywhere they want in the system. This is by design to protect the system and the user.

You are more than likely trying to create a folder at the root of a drive or in the Program Files folder, among others. If this is the case, you have to redesign your application so it stores its data in more appropriate locations.
 
Share this answer
 
Comments
abdul kamaal naser 18-Dec-11 23:55pm    
thanks can you give me some sample code
Dave Kreskowiak 19-Dec-11 8:07am    
Sample code?? For what?? You've already got the code to create a directory. You just have to pick a more suitable location to put your data. For a list of possible folder locations, look at http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx.
If u r try to create a directory in C drive please run u r application as administrator. Then it works
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900