my code below global.asax.cs
protected void Session_End(object sender, EventArgs e) {
string userId = Session["UserId"].ToString();
string path;
string[] filename;
path = System.Web.Hosting.HostingEnvironment.MapPath("~/temp/" +userId); //i have doubt here how write proper image path
filename = Directory.GetFiles(path);
for (int i = 0; i < filename.Length; i++) {
if (Session.SessionID == Path.GetFileName(filename[i])) {
string imgpath = filename[i];
FileInfo filepath = new FileInfo(imgpath);
if (filepath.Exists) {
File.Delete(filepath.FullName);
Session.Abandon();
}
}
}
}


Suthish NairRank #92 · 22.8K reputationPosted Jun 16, 2011, 7:23 PM EDT
Did you tried the following methods suggested..
System.IO.Path.GetTempFileName
System.IO.Path.GetTempPath
sagar Bhosale162 reputationPosted Jun 16, 2011, 8:29 PM EDT