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
176k
How to delete images from temp folder i save images in MembershipUserId_abc.jpg format
Jun 15 2011 10:23 AM
How to delete images from temp folder i save images in MembershipUserId_abc.jpg format delete event is happen when user is logout i can global.asax please help me
global.asax.cs
protected void Session_End(object sender, EventArgs e) {
string uId = Membership.GetUser(Context.User.Identity.Name).ProviderUserKey.ToString(); //here i got an error Object reference not set to an instance of an object.
string path;
string[] filename;
path = System.Web.HttpContext.Current.Server.MapPath("~/temp/");
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) {
filepath.Delete();
// Session.Abandon();
}
}
}
}
Reply
Answers (
9
)
sending mail to my gmail
How to conditionally display a Yes/No message box...