By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,956 Members | 1,722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,956 IT Pros & Developers. It's quick & easy.

Create Directory and Sub directory in Web Share (HTTP)

P: 37

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,
Jan 4 '09 #1
Share this Question
Share on Google+
1 Reply

P: 344
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.Directory class. as follow:

first get the actual directory that your site is allocated on the remote server
string onServerPath = Request.PhysicalApplicationPath;
second create the directory
if (!Directory.Exists(onServerPath + textBox1.Text))
Directory.CreateDirectory(onServerPath + 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.

Jan 4 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.