How to create a file folder using ASP.NET 2.0 ?

K

kai

Hi, All
I am trying to create a file folder for any login user, and create sub
folders for the user on a web page. After the user login again, he can only
sees his own folder on the Web page. I am planning to use VB2005 or C#.

I look the help files and searched on the web, I cannot find the answer. Is
this possble in ASP.NET 2.0?


Thanks

kai
 
A

Alexey Smirnov

Hi, All
I am trying to create a file folder for any login user, and create sub
folders for the user on a web page. After the user login again, he can only
sees his own folder on the Web page. I am planning to use VB2005 or C#.

kai,

use DirectoryInfo.Create to create the new folders

For each user/folder create a web.config file

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<authorization>
<allow users="usernamehere" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

and locate it in the folder. It helps to protect a folder from
unauthorized access.

Maybe you can explain more detail exactly what do you want to do
 
B

Bjorn Sagbakken

This can surely be done, but I would like to share my experience on files on
the web-server:
I designed an upload function for user files, but after some time the
administrator of the web-server was less happy about the volume of these
files (CD images and other large files). After some pondering I have decided
for another option; storing the user files in blob-fields on an SQL-server.
The administrator said this server had unlimited space, they only add more
HDD's far into TB. Well, in that way it is easy to store userid along with
the file and everything else you want to control access.

Bjorn
 
K

kai

Alexey,
Thank you for your help!
I want to create a web site which manages files for authorized users,
uploading and downloading.

1. A user can create a folder and sub folders for himself on a web page,
then can see his folders in tree views on the web page. The user can then
upload files and download files from his owen folder and subfolders.

2. The next time the user logs in, he will only see his owen folders
displayed on the web page, and it is protected from being accessed by other
users.


Thanks

Kai
 
K

kai

Bjorn,
Thank you very much for your help.
After storing files in the SQL Server, can them be organized in the
folders? Can user download the files from SQL Server?


Thanks

Kai
 
B

Bjorn Sagbakken

Of course, the user can download the files from the SQL server. The user
will not know the difference, not knowing exactly where the files have been
stored. After all, the user experience only basic HTML at his end. At the
server end there may be all sorts of magic...

Bjorn
 
A

Alexey Smirnov

Alexey,
Thank you for your help!
I want to create a web site which manages files for authorized users,
uploading and downloading.

1. A user can create a folder and sub folders for himself on a web page,
then can see his folders in tree views on the web page. The user can then
upload files and download files from his owen folder and subfolders.

2. The next time the user logs in, he will only see his owen folders
displayed on the web page, and it is protected from being accessed by other
users.

In principle, you don't need to create a folders. As Bjorn said, there
may be all sorts of magic. A "directory tree" can be saved as a
configuration in a database. All files can be either uploaded to
server drive in a global directory (plus names of the files in the
database), or stored directly in a database, as Bjorn has told you.

There are pros and cons of each solution and also a lot of discussions
about that matter

Just found an article that might be interesting to you, take a look
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=414
 
K

kai

Alexey,
This is a huge help! Thanks
Kai
Alexey Smirnov said:
In principle, you don't need to create a folders. As Bjorn said, there
may be all sorts of magic. A "directory tree" can be saved as a
configuration in a database. All files can be either uploaded to
server drive in a global directory (plus names of the files in the
database), or stored directly in a database, as Bjorn has told you.

There are pros and cons of each solution and also a lot of discussions
about that matter

Just found an article that might be interesting to you, take a look
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=414
 
K

kai

Bjorn ,
Thank for sharing your experiences.
After I insert a file for the user, how do you retrive the file for the
user? do you insert username and password into the files_Table?


Thanks

Kai
 
A

Alexey Smirnov

Bjorn ,
Thank for sharing your experiences.
After I insert a file for the user, how do you retrive the file for the
user? do you insert username and password into the files_Table?

just look at the article I've sent you, I think it's explained quite
good
 
B

Bjorn Sagbakken

I think the article Alexey sent you was excellent, it covers it all.
But to answer about my case: Yes I have a user login with username and
password. I keep the username (not the passord - this may be cahanging)
along with customerno and various credibilities in a session var, so each
form can set the appropriate properties for each user. And finally, the
username is stored in a column (LastChangedBy or OwnerID or AddedByID ...)
in various tables. On uploading files, my users have to specify a cathegory
and a description of the file. All this information along with current
datetime and the file itself is stored in a table.

Retrieving is very easy: SELECT * from FileTable WHERE OwnerID=LoginID

Bjørn
 

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