Live Chat Icon For mobile
Live Chat Icon

How to create a folder in ASP.NET

Platform: ASP.NET| Category: Files

Use System.IO namespace


Dim path As String = ''
 	’ Determine whether the directory exists.
	If Directory.Exists(path) Then
		Response.Write('That path exists already.')
	End If
	’ Try to create the directory.
	Dim di As DirectoryInfo = Directory.CreateDirectory(path)
	Response.Write(('Directory create successfully at ' + Directory.GetCreationTime(path)))
catch ex as Exception
	Response.Write (ex.Message )
end try


string path = @'c:\MyDir';
	// Determine whether the directory exists.
	if (Directory.Exists(path)) 
		Response.Write ('That path exists already.');
	// 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 );

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.