Create Directory and Sub directory in Web Share (HTTP)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Manikgisl
    New Member
    • Oct 2008
    • 37

    Create Directory and Sub directory in Web Share (HTTP)

    hi,

    can i want to create a directory in Web Share (HTTP) using C#...

    Can any body help by giving Sample Code for that ...


    Thanks in Advance

    With Regards,
    Mani
  • Bassem
    Contributor
    • Dec 2008
    • 344

    #2
    I don't know if i understood you well, but if you want to create directory in a web site using c# the System.IO.Direc tory class. as follow:

    first get the actual directory that your site is allocated on the remote server
    string onServerPath = Request.Physica lApplicationPat h;
    second create the directory
    if (!Directory.Exi sts(onServerPat h + textBox1.Text))
    {
    Directory.Creat eDirectory(onSe rverPath + textBox1.Text);
    }
    note: that if the directory that contains the directory you are attempting to create
    the containing directory will created first then the sub directory will be created.


    Thanks,
    Bassem

    Comment

    Working...