Click here to Skip to main content
15,917,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Good Morning !

I have One Requirement that i need to create Directory and Display on my website
So how can i do that ...

For example:

I enter Directory name in Textbox and when i click on button it should be Create on Webpage.

Thanks In Advance. :)
Posted
Comments
Raul Iloc 24-Jun-14 8:38am    
Did you try like I suggested in my solution?

1.First you should use a folder from your application as parent folder of all your folders, lets suppose that this folder will be named Content.

2.Then if you want also to give the user possibilities to download/have access to this folder you should set up some access rights in your application web.config like in the next example:
XML
<location path="Content">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

3.Finally you should use C# code to create the folder like in the next example:
C#
string newPath = Server.MapPath(string.Format("~/Content/{0}", folderNameWithoutPath));
            DirectoryInfo directoryInfo= new DirectoryInfo(newPath);
            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900