Directory.CreateDirectory Method throws UnauthorizedAccessException

G

GM

Any help is greatly appreciated! I'm up against a meeting deadline.

Directory.CreateDirectory Method throws UnauthorizedAccessException

Here is the path:

"C:\JumpStart\JumpStart\sites\Proto\images\sites.e-Plaza.org\Alece"

Everything before 'Alece' already exists.

I've tried the following:

For parent directory:
C:\JumpStart\JumpStart\sites\Proto\images\sites.e-Plaza.org

Set security permissions for ASP.NET to 'Modify' (and even full control)
Set security permissions for ISUR-server to 'Modify' (and even full control)

Set UNC share permissions of 'JumpStart' (parent) to 'Write'

Set IIS permissions for 'images' directory and subs to 'Write'

Still I get 'UnauthorizedAccessException'

THANKS!
Gary
 
G

Guest

Yes, This error makes sense. ASP.NET application runs under ASPNET account by default. IIS setting might allow users to write, but Windows security doesn't allow ASPNET user to do so.
2 possible solutions

1. Give ASPNET user more control; add him to User or Poweruser group. This might not be the best solution if security is your concern
2. Enable Win authentication on this site. Then enable impersonation in web.config file. This solution will work if it's an Intranet type application
 
G

GM

Whoops! I had quotation marks around the variable defining the path.
No amount of permissions were going to allow creating a "ImgDir" path.
 

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

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top