directory class

G

Guest

hi,
i've used Directory.GetFiles(path, "*.*", SearchOption.AllDirectories)
method to
return the files in a given path....

but i've a small concern here...whenever I give path like "d:\", i'm getting
an unauthorizedaccess exception...this is because i'm not able to read certain
directories like 'system volume information'...etc..

is any other alternative? how can i get the file list for a given path?
 
R

Roland Dick

AVL said:
hi,
i've used Directory.GetFiles(path, "*.*", SearchOption.AllDirectories)
but i've a small concern here...whenever I give path like "d:\", i'm getting
an unauthorizedaccess exception...this is because i'm not able to read certain

Hi AVL,
you can use GetFiles IMHO, but you have to keep in mind that whichever
account the webapplication runs under must have reading permission on
the path. If you have set up your webapplication to use the anonymous
account (most likely the local "IUSR_<MachineName>" account) then you
must add that account with reading permissions to the ACL of drive d:.
By default, that account only has permissions on the wwwroot directory
of IIS (AFAIK, and not considering GAC etc.).

If you're working on an intranet site, maybe windows integrated
authentication would be an option?

Hope this helps,

Cheers,

Roland
 

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,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top