Session

1.Global.asax中Session_Start()中添加

Session["VoiceFiles"] = new List<string>();

2.用到时
List<string> files = Session["VoiceFiles"] as List<string>;
string fileName = Path.GetRandomFileName() + ".wav";

files.Add(fileName);

3.退出时
        List<string> files = Session["VoiceFiles"] as List<string>;
        foreach (string fileName in files)
        {
            try
            {
                File.Delete(fileName);
            }
            catch (IOException) {/*...*/}
        }

你可能感兴趣的:(session)