Hi friend, i have one problem that in my project temp folder where i upload images according userid so images is uploaded in temp folder in this manner userid_abc.jpg in this format
so my problem is that how to delete that images according that userid
using foreach loop how i collect images according to userid then matching that userid how i will delete images pleaz help me i very trouble to find out solution
i want to my code in above format how can i do this pleaz help me
my code is global.asax.cs
protected void Session_End(object sender, EventArgs e) {
string userId = Session["UserId"].ToString();
string path;
string ImagePath =Session["Imagepath"].ToString();
path = System.Web.Hosting.HostingEnvironment.MapPath("~/temp/" + userId + "_" + ImagePath);
FileInfo filepath = new FileInfo(path);
if (filepath.Exists) {
File.Delete(filepath.FullName);
Session.Abandon();
}
}