Using System.IO Namespace; string path = @"c:\file1"; try { // check whether the directory exists. if (Directory.Exists(path)) { Response.Write("That path exists already."); return; } // Try to create the directory. DirectoryInfo di = Directory.CreateDirectory(path); Response.Write("Directory create successfully at " + Directory.GetCreationTime(path)); } catch(Exception ex) { Response.Write (ex.Message ); }
Using System.IO; if(File.Exist("Path_of_folder")) { Response.Write("File Exists"); } else { Response.Write("File does not Exist"); }
<a style = "text-decoration:none;" href = "http://www.dotnetfunda.com">Dot Net Funda</a>