Vasu Gadhiya

Vasu Gadhiya

  • NA
  • 594
  • 58.9k

Access is denied error when folder create using code.

Sep 12 2013 12:22 AM
I Write Code for creating Folder.

in local System Its Completely Work, but when i host Website and run this page server occur this Error.

Server Error in '/swebsite' Application.

Access to the path 'D:\Hosting\11588943\html\swebsite\date\12-09-2013' is denied.

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code

Line 22:             if (!System.IO.Directory.Exists(path)) // check if folder exist
Line 23:             {
Line 24:                 System.IO.Directory.CreateDirectory(path); // create folder for past last day ex  =  10-09-2013
Line 25: 
Line 26:                 string[] files = System.IO.Directory.GetFiles(sourcepath);

Answers (3)