How to create a directory with web-base program?

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

We can use System.IO namespace to create a directory in win-base program.

But when I want to create a directory in the server with web-base program,
System.IO namespace can't work?

How can I do that?
 
You need to allow the ASP.NET process to write to disk and create
directories/files. There's nothing in System.IO that ceases to work when
called within the context of a web application - it's just that web
application have lower privileges than normal desktop ones.

This is an NTFS permission issue. If you adjust those you should be able to
do whatever you want to the disk.
 
ad said:
We can use System.IO namespace to create a directory in win-base program.

But when I want to create a directory in the server with web-base program,
System.IO namespace can't work?

How can I do that?

The System.IO namespace works absolutely fine - but you need to make
sure that the ASP.NET account has all the permissions needed to do
whatever you want to do.
 
Thank,
I will try it!
James Curran said:
System.IO should work just fine. You'll probably need Server.MapPath()
to translate the web address into a local disk path. Also note that the user
that the webserver is running under (usually, IUSR_xxxxxxx) needs to have
permission to write into that directory.

--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com


ad said:
We can use System.IO namespace to create a directory in win-base program.

But when I want to create a directory in the server with web-base program,
System.IO namespace can't work?

How can I do that?
 
Back
Top