Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create directory as a different user then ASPNET

Status
Not open for further replies.

ralphtrent

Programmer
Jun 2, 2003
958
US
Hello
I need to create a directory on a server location that ASPNET does not have access to. I am using
Code:
System.IO.Directory.CreateDirectory
to create the directory but I am getting permission errors. I know I can set certain user credentials when I use the WebClient class (which I am also using in the same function). Is there a way to use these credentials to create the directory?

Thanks,
RalphTrent
 
I assume this is an intranet application otherwise you can't get access to the remote machine. One option is to use windows authentication on IIS which will delegate the clients credentials on the server. from there you can setup delegation within Active Directory to delegate user credentials from the web server to the remote server (where the directory will be created). As long as the user has access to create the directory on the remote server there will not be any problems.

to setup delegation in AD open the properties window the web server in AD. i think it's the security tab. look for a checkbox to enable delegation. choose the authentication model and save changes.

if that's not a option I think you can impersonate a user on another thread. have this thread created the directory, when you're done with the thread dispose of it. i haven't done anything like that before, but in theory it's possible.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
What my goal is this. I have an application that list files from a remote server. If the uer wants to save the file, they need to download them one-by-one. I want to come up with a way to download all of them at once. I am not sure how to allow the use to select the folder on their machine in asp.net. I now about the file input button in HTML, but that is only a file, not a folder. Any ideas on how i can accomplish this?
 
I am not sure how to allow the use to select the folder on their machine in asp.net.
You will have to use a client side language such as javascript.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top