Chapter 22. Uploading Content: Building a File Repository Application

In This Chapter:

  • The Main Menu

  • The Manage Files Page

  • The Edit Files Page

  • The Delete Group Page

  • The Add File Page

  • The Search Page

  • The Show Group Page

  • The Edit Profile Page

Many Web sites offer downloadable files. The Web sites I visit most often that take a systematic approach to managing downloadable files are programming sites that offer programs and source code for downloading. Many of these Web sites have a convenient way to display a list of files, along with descriptions and version numbers. The files can be grouped by category, or possibly grouped by whoever uploaded them.

This chapter builds a file repository application. With this application running on a Web server, users can create their own file groups, upload files, and edit the information for each file. Other users can search for files that match specified search criteria, and then download files that turn up. It's a great way to manage user-uploaded files.

In the process of building this application, we'll talk about uploading files to the server, doing file I/O and a number of other things such as using cookies, and doing Form-based authentication. The methods of the application are shown in Table 22.1. This table will act as a handy reference as you use and study the application. Figure 22.1 shows the hierarchy of the files in the application. Note that ShowGroup is a stand-alone page that is meant to be called from other applications.

Figure 22.1. This Is the Hierarchy for the File Repository Pages.

graphics/22fig01.gif

Table 22.1. The File Repository Application Methods

Method

Listing

Source Code File

Description

Page_Load

22.1

Default.aspx.cs

This method is called when the default.aspx page is loaded.

LogOut_Click

22.1

Default.aspx.cs

This method is fired when the user clicks the Log Out button.

Admin_Click

22.1

Default.aspx.cs

This method is fired when the user clicks the Admin button.

Search_Click

22.1

Default.aspx.cs

This method is fired when the user clicks the Search button.

Manage_Click

22.1

Default.aspx.cs

This method is fired when the user clicks the Manage button.

Profile_Click

22.1

Default.aspx.cs

This method is fired when the user clicks the Edit Profile button.

Page_Load

22.2

Login.aspx.cs

This method is called when the Login.aspx page is loaded.

LogUser

22.3

Login.aspx.cs

This method attempts to match a user name and password with an entry in the database, or it adds a record for a new user.

LoginUser_Click

22.3

Login.aspx.cs

This method is fired when the user clicks the Login button.

NewUser_CheckChanged

22.3

Login.aspx.cs

This method is fired when the user selects or deselects the New User checkbox.

BindDataToControls

22.4

MngFiles.aspx.cs

This method binds the group and file data to the databound controls.

Page_Load

22.5

MngFiles.aspx.cs

This method is called when the MngFiles.aspx file is loaded.

AddGroup_Click

22.5

MngFiles.aspx.cs

This method is fired when the user clicks the Add Group button.

Main_Click

22.5

MngFiles.aspx.cs

This method is fired when the user clicks the Main Menu button.

Page_Load

22.6

EditFile.aspx.cs

This method is called when the EditFile.aspx page is loaded.

Main_Click

22.6

EditFile.aspx.cs

This method is fired when the user clicks the Main Menu button.

Cancel_Click

22.6

EditFile.aspx.cs

This method is fired when the user clicks the Cancel button.

Delete_Click

22.6

EditFile.aspx.cs

This method is fired when the user clicks the Delete button.

Save_Click

22.6

EditFile.aspx.cs

This method is fired when the user clicks the Save button.

ShowGroupName

22.7

DeleteGroup.aspx.cs

This method shows the group name, which is contained in a session variable.

Cancel_Click

22.7

DeleteGroup.aspx.cs

This method is fired when the user clicks the Cancel button.

OK_Click

22.7

DeleteGroup.aspx.cs

This method is fired when the user clicks the OK button.

Save_Click

22.8

AddFile.aspx.cs

This method is fired when the user clicks the Save button.

Cancel_Click

22.8

AddFile.aspx.cs

This method is fired when the user clicks the Cancel button.

Main_Click

22.8

AddFile.aspx.cs

This method is fired when the user clicks the Main Menu button.

Main_Click

22.9

Search.aspx.cs

This method is fired when the user clicks the Main Menu button.

PerformSearch_Click

22.9

Search.aspx.cs

This method is fired when the user clicks the Perform Search button.

Page_Load

22.10

ShowGroup.aspx.cs

This method is called when the ShowGroup.aspx page is loaded.

ShowGroupName

22.10

ShowGroup.aspx.cs

This method shows the group name, which is contained in a session variable.

Page_Load

22.11

EditProfile.aspx.cs

This method is called when the EditProfile.aspx page is loaded.

Update_Click

22.11

EditProfile.aspx.cs

This method is fired when the user clicks the Update button.

Cancel_Click

22.11

EditProfile.aspx.cs

This method is fired when the user clicks the Cancel button.

ShowGroupName

22.11

EditProfile.aspx.cs

This method shows the group name, which is contained in a session variable.



ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ISBN: 321159659
EAN: N/A
Year: 2003
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net