TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sagar Bhosale
NA
179
175.6k
How to delete uploaded images from Temp folder when user is logout using global.asax in asp.net
Jun 14 2011 5:16 AM
How to delete uploaded images from Temp folder when user is logout using global.asax in asp.net
my global.asax.cs code please help me
protected void Session_End(object sender, EventArgs e) {
string uId = Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString();
string path;
string[] filename;
path = System.Web.HttpContext.Current.Server.MapPath(@"\Images");
filename = Directory.GetFiles(uId + "_" + path[path.Length - 1]);
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(Server.MapPath("~/temp/" + filepath.FullName));
Session.Abandon();
}
}
}
}
Reply
Answers (
6
)
how to split string dynamically
regenerate password in 3 tier architecture using database