Namespaces used: System.IO
The files we want to create require asp.net users to have certain privileges!
Using System;
Using System.Collections;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Web;
Using System.Web.SessionState;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
Using System.Text;
Using System.IO;
Namespace New_app
{
<summary>
Summary description of the myxml.
</summary>
public class Myxml:System.Web.UI.Page
{
Private Const string file_name = "D:myfile.txt";
private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page
Write_file (file_name);
}
A way to create a file and enter it in a file
public void Write_file (string file_name)
{
if (file.exists (file_name))
{
Console.WriteLine ("{0} already exists.", file_name);
Return
}
StreamWriter sr = File.createtext (file_name);
Sr. WriteLine ("This is my first program.");
Sr. WriteLine ("by zixian2005");
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