Tutorial: Asp.net and Xml Development Network Hard Drive Technology

Source: Internet
Author: User

FTP, Email, and "Network neighbors" are commonly used for file data transmission to a certain extent, but they are mainly for "point-to-point" transmission, it is impossible to meet the application requirements of "One space, Resource Interaction". This "Point-to-multiple" sharing mode requires another transmission path. Network hard disk is a good solution. Common transmission methods and the difficulties we face in a specific environment we often have the need to exchange public data files over the network for resource sharing, while protecting private data from unauthorized access, and easy to use and intuitive operation.

 


Ewedrive provides 1 GB of free storage space, but it does not limit the size of a single file.

Our common file transmission methods include FTP, Email, and network neighbors. Among them, "Ftp" is the most powerful, but it is a little complex to use, a lot of settings are enough to let many people stop, especially when the number of users is unpredictable, user settings for special needs will be more complicated; "Email" is familiar to everyone, but its transmission requires you not only to connect to the Internet, but also its security is also a problem, within an enterprise, it is not a good way to exchange documents such as finance and labor resources. "Network neighbors" are another method for transferring documents, by specifying shared Web folders on the local machine and placing resource files, users within a certain range can access these files. However, this method is widely used, generally, users in the same DNS segment can access the domain name smoothly. Other users, especially those on the Internet, are difficult to use. In addition, similar to Email, the domain name is not intuitive, most of the time, you have to expand the search layer by layer on many list computers to obtain the resources you want! From this point of view, although the above three methods have achieved the communication of file data to a certain extent, however, they are mainly oriented to "point-to-point" transmission (you can only passively wait for the other party to place data, rather than actively "Visually" requests), and cannot implement "one space, resource Exchange "application requirements, this" Point-to-multiple "based sharing method needs to seek another transmission channel, network hard disk is a good solution.


Onedump

The OneDump bucket is not limited in size, but a single file is only 5 MB in size and 10 files are transferred at the same time, which can be used to store documents and other things.

The advantage of a network hard disk, also known as a shared space, is a hard disk space on the server. Here, if you have sufficient permissions, you can operate on it at will, just like using your local computer. You must know that all of this is transmitted over Http and displayed in front of all users in the form of Web. You can use a browser to access it. In this way, "a space, the sharing mode of resource mutual view is realized! In addition, the network hard disk interface runs on the client. It allows users to submit data to the server and manage the information within the specified range. This processing mode is widely used in actual development, especially in the construction of an interactive network document management system: Online examination system, file transmission system, news and publishing system, and the company bidding system have a large number of applications! The following uses Asp.net (implemented in Visual C #) and Xml (Extensible Markup Language) to develop such a network hard drive system. Detailed descriptions of program development details and Key Technologies and difficulties used in code are provided. You can develop your own network hard drive by referring to these instructions.

Functions of network Hard Disks

Our network hard drive provides the following features:

1. View folder content
2. You can set access permissions when creating a new folder.
3. jump between folders: Go to the next level and return to the previous level
4. upload a file to a specified folder
5. download the file to your local computer or view the file content online.
6. delete files or folders

Development details and key technical points

1. view the folder content: At the beginning, the program will enter the specified root folder (for example, \ NetHard). The content in this folder will be displayed in the list through the data binding control (DataGrid, the options include category (difference between folders or files), name, and permission (whether to allow access to folders? Can an object be downloaded ?) , Delete (Are you allowed to delete files or folders ?) And the creator of the folder. Here, because the content in the folder changes dynamically (you Don't know when a user transfers files, creates folders, or deletes them ), we dynamically create a data table able to read the content in the specified folder and bind it to the display control DataGrid as a data source. In this way, data display is always timely. The function for creating a dynamic table is as follows: public DataTable Bind (string fullFolderPath) // create a data table to read the folder content

{
// The following describes how to dynamically create a data table:
DataTable dt = new DataTable ();
DataRow dr;
// Create a data table structure
Dt. Columns. Add (new DataColumn ("type", System. Type. GetType ("System. String"); // type
Dt. Columns. Add (new DataColumn ("name", System. Type. GetType ("System. String"); // name
Dt. Columns. Add (new DataColumn ("action", System. Type. GetType ("System. String"); // operation
Dt. Columns. Add (new DataColumn ("owner", System. Type. GetType ("System. String"); // creator
// Fill in data for each row
Foreach (string d in Directory. GetFileSystemEntries (fullFolderPath )){
Dr = dt. NewRow (); // create a new row
String [] parts = d. Split (new char [] {'\'});
String txt = parts [parts. Length-1]; // obtain the last part of the string, which may be a file name or folder
Dr [1] = txt; // name
If (File. Exists (d) // if it is a File
{
Dr [0] = "file"; // type
Int pos = currFullPath. IndexOf ("NetHard ");
String relaUrl = currFullPath. Substring (pos );
String
Url = "http: // 10.80.50.1/SharedSpace/" + relaUrl + "/" + txt ;//
10.80.50.1 is the author's server address. You should modify it to your server address.
Dr [2] = "Download ";
}
Else if (Directory. Exists (d) {// if it is a folder
Dr [0] = "folder"; // type
String password = GetFolderPassword (d); // get the folder password information
Int type = GetFolderLimitType (d );
If (password! = "No") & (type! = 1 ))
Dr [2] = "href = PasswordValidate. aspx? Path = "+ d +"> seal "; // action
Else
Dr [2] = "go"; // action
Dr [3] = GetFolderOwner (d); // get the name of the folder creator
}
Else
Response. Write ("");
Dt. Rows. Add (dr); // Add a row
Return dt; // return data table
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.