Best Practices for File Access

D

DavidElliott

I am trying to do File Access for an ASP.NET project and am having some
difficulty. I was wondering if a document on Best Practice for File Access exists
somewhere.

Scenerios I am looking to solve.

1) Attach an XML file to a WebControl TreeView
2) Anonymous access for pictures
a) That exist in the virtual directory
b) Exist on another disk partition
3) Restricted access for read/write based on person or group

I am aware of authorization and authenication and know how to implement
them.

If there are some examples or documents on how to do this properly,
(i.e. NO Hacks), I would most interested.

Thanks,
Dave

(e-mail address removed)
 
S

Steve C. Orr [MVP, MCSD]

If you store your files in SQL Server then you can let it handle most of
these details.
Here's further information on that techique:
http://www.aspnetpro.com/features/2003/07/asp200307so_f/asp200307so_f.asp

Otherwise you'll probably store your restricted files in a private folder
and use Response.Writefile once you've determined the user is authorized:
http://msdn.microsoft.com/library/d...fsystemwebhttpresponseclasswritefiletopic.asp

To find out if a file exists you can use the System.IO.File.Exists method.
Here's more info:
http://msdn.microsoft.com/library/d.../cpref/html/frlrfsystemiofilememberstopic.asp
http://msdn.microsoft.com/library/d...s/cpguide/html/cpconreadingwritingtofiles.asp
 
D

David Elliott

I don't think that I was clear. I am looking for HOW set permissions to files and
folders appropriately, given the scenerios below, so that the appropriate individuals
can access the files to read and write.

For example I could start IIS right click on a folder, go to directory
security and enable anonymous access. This is probably not the
best idea especially if files are only read or written by select individuals.

What are other methods are available.

Scenerios I am looking to solve.

1) Attach an XML file to a WebControl TreeView
2) Anonymous access for pictures
a) Read files that are in the virtual directory
b) Read files that are on another disk partition
3) Grant read / write permissions to individual files based on a person or group
and allow them to read / write..


Thanks,
Dave

(e-mail address removed)
 

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