Creating a Folder ASP.Net

  • Thread starter Thread starter Scott D
  • Start date Start date
S

Scott D

I am using the following code to create a folder:

FSO = Server.CreateObject("Scripting.FileSystemObject")
Folder = FSO.CreateFolder("c:\" & Me.textbox1.Text & "_" &
Me.textbox2.Text & "_" & newString)

I have no problem creating the folder on a local drive. However, when
I attempt to create the folder using a UNC name (i.e. \\server\share)
I receive a login error. Does anyone know how to pass credentials to
the CreateFolder object? If not is there another way I can accomplish
creating folders on a remote share?
 
It is most likely because of ASPNET user account, under which your ASP.NET
app runs, does not have permission to create folder. Also, why not use
System.IO namespace, now that this is .NET application?
 
Do you have an example of using System.IO for folder creation? I am
new to the programming world and would like to do it the correct way.
 
For file and directory ( when in DOS age, it was called "Directory", then MS
thought "Folder" was better tahn "Directory" since Win95, now, in .NET, MS
use "Directory" again ) handling, see the classes: System.IO.File,
System.IO.FileInfo, System.IO.Directory, and System.IO.DirectoryInfo. To
create directory, you can use System.IO.Directory.CreateDirectory() method,
or System.IO.DirectoryInfo.Create() method.

Again, in your ASP.NET app, you have to solve permission issue if you want
the ASP.NET user to create folders on server.
 
Back
Top