I'm pretty sure there is a more elegant way to do this. Any suggestion?
Here is the code. It's inside a method (FillChildNodes) which is called
recursively
-------------
DirectoryInfo[] subDirs = rootFolder.GetDirectories();
if (subDirs != null && subDirs.Length > 0)
{
foreach (DirectoryInfo dir in subDirs)
{
if (dir.Exists)
{
try
{
TreeNode tn = BuildTreeNode(dir);
FillChildNodes(tn,dir);
tn.Nodes.Add(tn);
}
catch (UnauthorizedAccessException uaex)
{
}
}
}
}
-------------------
BuildTreeNode method only does:
-------------------
tn.ID = dir.ToString();
tn.Text = dir.Name;
-------------------
What concerns me if the test method I'm using to check if I can read the
directory.
I've tried using DirectoryInfo.Exists attribute an Directory.Exists()
method, but neither worked.
The above method works fine on an XP Pro with SP2, IIS configured with
integrated security and no anonymous access allowed, and <identity
impersonate="true"/> in the web.config file.
HTH,
Nicole
"Lalo" <La...@discussions.microsoft.com> wrote in message
news:ECE0BE42-F127-442A...@microsoft.com...
What we want to do is implement something like windows explorer, via web,
but instead of saying "Hey, you can't access that folder", filter the folders
the user can't access and don't show them in the tree.
"Lalo" <La...@discussions.microsoft.com> wrote in message
news:2F1AC1E4-97A1-4532...@microsoft.com...
If the user needs a report file inside some folder, our security
administrator should grant access to all the folders in the path to reach
that file.