Dynamically created directory not recognized by web server

G

Guest

With XPpro, I am programmatically creating sub-folders within the virtual
directory of my app. I programmatically set read/write permissions and then
successfully write some files to the directory. All of this works fine.

But when I try to browse the new directory through IE, it does not see it.
The error message is:
HTTP 403.1 Forbidden: Execute Access Forbidden
Internet Information Services

The code to create the directory is:

Dim fullPath As String = Request.PhysicalApplicationPath &
"userResources\" & newUserDir
Dim di As DirectoryInfo = New DirectoryInfo(fullPath)
di.Create()

' now to set the permissions
Dim f2 As New FileIOPermission(FileIOPermissionAccess.Read,
fullPath)
f2.AddPathList(FileIOPermissionAccess.Write Or
FileIOPermissionAccess.Read, fullPath)


The directory structure is this (where dir1 is the dynamically created dir):
c:\iNetpub\wwwRoot\myApp
c:\iNetpub\wwwRoot\myApp\userDirectories\dir1
c:\iNetpub\wwwRoot\myApp\userDirectories\dir1\graphic_that_wont_display.gif
 
J

Joshua Flanagan

You are misunderstanding the function of the FileIOPermission class.
FileIOPermission is used to declare what parts of the file system your
code should be allowed to access. It is part of the .NET code access
security model. It has nothing to do with changing the ACL's on the
file system.

In .NET 1.0/1.1, I don't believe there is any built in way to manipulate
file system ACLs (there will be in .NET 2.0). You will have to do it
through P/Invoke calls to the Win32 API. I don't think it is simple,
but you can probably find examples on the net.


Joshua Flanagan
http://flimflan.com/blog
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top