468,549 Members | 2,344 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,549 developers. It's quick & easy.

Session end event fires but it is not executing code

I am trying to delete a file from a disk when the user's
session ends. So I am putting my file.delete code in
Session_End event. I ran the application in the debug
mode. When the session timesout session event is firing
but it is not executing any of my delete code. Can
somebody tell me what I am doing wrong?

Thanks in advance
Nov 17 '05 #1
4 7216
If you are using session mode other then InProce, session_end will not fire.

If you are usnig inproc - then how do u know it's firing if your code is not
being executed?

Also, posting the code would be helpful.

"Sampriti" <su*****@mailcity.com> wrote in message
news:0f****************************@phx.gbl...
I am trying to delete a file from a disk when the user's
session ends. So I am putting my file.delete code in
Session_End event. I ran the application in the debug
mode. When the session timesout session event is firing
but it is not executing any of my delete code. Can
somebody tell me what I am doing wrong?

Thanks in advance

Nov 17 '05 #2
how do you know the Session_End event is firing? If your delete code is
correct, and works, and the session_end event is firing, and your delete
code is called in session_end, then there isn't a reason for it not to work

unless, you don't have permission to delete the file? Did you step into it
and verify that the delete code is running?

"Sampriti" <su*****@mailcity.com> wrote in message
news:0f****************************@phx.gbl...
I am trying to delete a file from a disk when the user's
session ends. So I am putting my file.delete code in
Session_End event. I ran the application in the debug
mode. When the session timesout session event is firing
but it is not executing any of my delete code. Can
somebody tell me what I am doing wrong?

Thanks in advance

Nov 17 '05 #3
What Console are you trying to write to?

Instead, try logging the beginning of Session_End to a database or
something. Make sure it is executing.

"sampriti" <su*****@mailcity.com> wrote in message
news:05****************************@phx.gbl...
This is how I know my session end event is firing
1.I have put break point on first line of code in
session_end event.
2.when the event fires the breakpoint which is red
initially turns yellow.
3.When I click stepInto nothing happens and breakpoint
turns red.
Here is my file delete code in session_end event of my
global.asax file
string strSessionDatasetFile = Server.MapPath
("~/SearchXML/"+Session.SessionID+".xml");
FileInfo fi = new FileInfo(strSessionDatasetFile);
if(fi.Exists)
{
// delete the file
try
{
fi.Delete();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

}
-----Original Message-----
If you are using session mode other then InProce,

session_end will not fire.

If you are usnig inproc - then how do u know it's firing

if your code is not
being executed?

Also, posting the code would be helpful.

"Sampriti" <su*****@mailcity.com> wrote in message
news:0f****************************@phx.gbl...
I am trying to delete a file from a disk when the user's
session ends. So I am putting my file.delete code in
Session_End event. I ran the application in the debug
mode. When the session timesout session event is firing
but it is not executing any of my delete code. Can
somebody tell me what I am doing wrong?

Thanks in advance

.

Nov 17 '05 #4
Rad
(insufficient) permissions on the file..
"Sampriti" <su*****@mailcity.com> wrote in message
news:0f****************************@phx.gbl...
I am trying to delete a file from a disk when the user's
session ends. So I am putting my file.delete code in
Session_End event. I ran the application in the debug
mode. When the session timesout session event is firing
but it is not executing any of my delete code. Can
somebody tell me what I am doing wrong?

Thanks in advance

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Paul | last post: by
6 posts views Thread by Patrick Olurotimi Ige | last post: by
5 posts views Thread by news.microsoft.com | last post: by
5 posts views Thread by Sean | last post: by
5 posts views Thread by news.microsoft.com | last post: by
11 posts views Thread by David Thielen | last post: by
6 posts views Thread by Marcus | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.