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 NairPosted Jun 16, 2011, 11:23 PM
Did you tried the following methods suggested..
System.IO.Path.GetTempFileName
System.IO.Path.GetTempPath
sagar BhosalePosted Jun 17, 2011, 12:29 AM