c# - create directory error while not entering into if condition -


i have problem directory creation:

if (!directory.exists(directorypath)//here have problem not enter if contion  {     directory.createdirectory(directorypath);     clientscript.registerstartupscript(this.gettype(), "alert", "alert('successfully saved');", true); } else {     clientscript.registerstartupscript(this.gettype(), "alert", "alert('directory exists');", true); } 

can please ?

try {     if (!directory.exists(directorypath))     {         directory.createdirectory(directorypath);         clientscript.registerstartupscript(this,this.gettype(), "alert", "alert('successfully saved');", true);     }     else     {         clientscript.registerstartupscript(this,this.gettype(), "alert", "alert('directory exists');", true);     } } catch(exception ex) {     throw; } 

i believe have problem parenthesis on first line, , please make sure directorypath has valid path


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -