Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

My project folder says D:/Projects/MyProject.... which contains all files like all aspx pages and all.

Now I have created another folder programatically like D:/Projects/MyProject/MyProjectNew

Whcih contains all the files from the main project folder that is MyProject. Now on button click I want to rename MyProjectNew to another name. I used Directory.Move but it is saying that permission is denied but there is already permissions assigned when same code I applied for one demo folder to only rename it was working but for MyProjectNew its not working as it is having all project files like aspx,cs,files.

Can anybody tell me how I can do this.

Thanks

Prashant
Posted
Updated 2-Jan-11 23:57pm
v2
Comments
[no name] 3-Jan-11 8:24am    
What is wrong with F2 in Windows Explorer to rename the folder?

Your web runs in the context of a special user: NetworkService or whatever else your server has been configured to use. This user needs the correct permissions. On IIS 7.x it's somewhat more convoluted:
http://learn.iis.net/page.aspx/624/application-pool-identities/[^]

Regards
Espen Harlinn
 
Share this answer
 
First of all Add Reference to Microsoft.Scripting.Runtime from COM Component.

Second - Include this Namespace in your .cs Page using Scripting;

Third - Now Create FileSystemObjectClass object and use it as various Working like Rename, copy, Add, Delete Folder and Files.

Thanks & Regards
AARIF SHAIKH
 
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