How to create folder using URI

G

Guest

I'm new to .NET and C#. I need help in trying to do the following:
I need to use a URI (or something else) that allows all users of the
application to be able to access a directory and create a folder. The code
that works for some users is:
string DirLoc = "\\\\abc-prod01\\c$\Inetpub\\wwwroot\\Units\\"
Directory.CreateDirectory(DirLoc);
Users that (I assume) don't have access on this web server, get the
following message: Could not find a part of the path "\\abc-prod01\\c$".

Since that doesn't work for everyone, I thought that using a URI would work.
The one I used is:
string DirLoc = "file://abc-prod01/Units$"
Directory.CreateDirectory(DirLoc);
When using the URI, I receive the following message: URI Formats Not
Supported. So, does this mean I can't use URI's at all or that I formated the
URI incorrectly.
Please HELP!
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You may have security problems with that, usually the asp.net process runs
under a restricted user that has no permission to create folders in the hdds
, the best thing to do is create a dir inside the current application ( even
so probably you will have to give permission to access ths dir to the
asp.net user )
you use Server.MapPath to make the conversion between the web app folder
names and its physical location in the hdd.



Cheers,
 
W

Willy Denoyette [MVP]

Your problem is a security issue which you are trying to bypass using
something that is not supported and would not work either if it was.
If your users don't have access to your webserver, why do you want them to
create directories on a file server?

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top