asp.net 在网页中对文件进行操作,该如何处理
asp.net 在网页中对文件进行操作
我在做cms的时候遇到了一个问题,就是对文件进行创建,读写等操作的问题,其中最关键的就是不会写文件操作的代码,如果哪为高手能给出相应的代码,将感激不尽。
------解决方案--------------------
写文件
我在做cms的时候遇到了一个问题,就是对文件进行创建,读写等操作的问题,其中最关键的就是不会写文件操作的代码,如果哪为高手能给出相应的代码,将感激不尽。
------解决方案--------------------
写文件
- C# code
using System; using System.IO; class Test { public static void Main() { // Create an instance of StreamWriter to write text to a file. // The using statement also closes the StreamWriter. using (StreamWriter sw = new StreamWriter("TestFile.txt")) { // Add some text to the file. sw.Write("This is the "); sw.WriteLine("header for the file."); sw.WriteLine("-------------------"); // Arbitrary objects can also be written to the file. sw.Write("The date is: "); sw.WriteLine(DateTime.Now); } } }