File processing in asp.net (4)

Source: Internet
Author: User
Tags file copy
asp.net four. Complete the copy, move, and delete of files in the ASP.net page

It is easier to copy, move, and delete files in asp.net. This is because the method of copying and moving files is defined in the namespace System.IO. Call these methods directly to complete the above operation. Examples of file copying, moving, and deleting are given below.

1). File copy operation

<% @ Import Namespace = "System.IO"%>
<%
' The following statement completes the file copy work
File.Copy ("C:\sample.txt", "C:\temp.txt")
Response.Write ("Copy of file has been successfully completed!") " )
%>
2). File Move operation
<% @ Import Namespace = "System.IO"%>
<%
' The following statement completes file move work
File.move ("C:\sample.txt", "D:\sample.txt")
Response.Write ("The file's mobile work has been completed successfully!") " )
%>
3). File deletion operation
<% @ Import Namespace = "System.IO"%>
<%
' The following statement completes the file deletion work
File.delete ("C:\sample.txt")
Response.Write ("File deletion work completed successfully!") " )
%>

Five Summarize:

To be flexible in using ASP.net, full of. NET's powerful capabilities, to achieve the seemingly difficult work we do, we must master the. NET Framework SDK developed by Microsoft for the. You can also only master the contents of the. Net FrameWork SDK.


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.