How to create a folder in C# programmatically
How to create a folder in asp.NET web site programmatically using C# ?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Prabhakar PariharRank #1,307 · 1.3K reputationPosted Apr 14, 2011, 12:13 AM EDT
Try this . . string pathToCreate = "~/UserFolders/" + TextBox1.Text; if(Directory.Exists(Server.MapPath(pathToCreate)) { //In here, start looping and modify the path to create to add a number //until you get the value needed } //Now you know it is ok, create it Directory.CreateDirectory(Server.MapPath(pathToCreate));Suthish NairRank #92 · 22.8K reputationPosted Apr 14, 2011, 4:05 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Apr 14, 2011, 11:23 AM EDT