其实我就是要做一个使用记数器,用一个文本文件HOME\counter.txt记录使用次数.
基本结构:
void Session_Start(object sender, EventArgs e)
{
..
读HOME\counter.txt
判断<=50
写HOME\counter.txt
..
}
给我一个方法吧,为这个东西折腾了5天了!没办法啊!老兄!第一次做一个的完整的程序!难啊!
基本结构:
void Session_Start(object sender, EventArgs e)
{
..
读HOME\counter.txt
判断<=50
写HOME\counter.txt
..
}
给我一个方法吧,为这个东西折腾了5天了!没办法啊!老兄!第一次做一个的完整的程序!难啊!
如
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);
}
}
}
同意小兵的。可以改成在数据库里。