其实我就是要做一个使用记数器,用一个文本文件HOME\counter.txt记录使用次数.
基本结构:
void Session_Start(object sender, EventArgs e)
{
..
读HOME\counter.txt
判断<=50
写HOME\counter.txt
..
}
给我一个方法吧,为这个东西折腾了5天了!没办法啊!老兄!第一次做一个的完整的程序!难啊!

解决方案 »

  1.   

    参考一下MSDN.

    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);
            }
        }
    }
      

  2.   

    目标计算机的aspnet帐号是否对存放counter.txt的路径没有Write权限?
      

  3.   

    dicman(小兵(★OMG★)) 
    同意小兵的。可以改成在数据库里。