How to create a folder in weberver?

Posted by Rajujrk under ASP.NET on 3/9/2010 | Views : 1240 | Status : [Member] | Replies : 3
Hai all,

I need to create a folder dynamically based on the user name. i want to create it within my source directory in the webserver? how to create it in c#.net?

Thanks & Regards

Rajkumar J



Responses

Posted by: Vuyiswamb on: 3/9/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
use this

System.IO.Directory.CreateDirectory(@"c:\NewFolder");


Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhijit Jana on: 3/9/2010 [Member] [MVP] Bronze

Up
0
Down
You can create it easily using

System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "\\MyFolder");


But you need to take care of some things .

As you application will run on server and client will try to create button on server, then Client will receive "Access Denied" error as They does not have sufficient permission to write on server.
What you need to do, You can give Write access to the folder where you want to create the sub folder to every one, which I personally think not a good idea or Create a separate application pool for your application, Change the Identity of Application pool to "Local System" Which having full permission to write on server . By default it is "Network Service" Which having minimum permission like access.

Hope this will help you !!


Cheers !
Abhijit

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/25/2010 [Member] Bronze

Up
0
Down
check following links

http://www.15seconds.com/issue/071012.htm

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response