Professional Web Applications Themes

Session end event fires but it is not executing code - ASP.NET General

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...

  1. #1

    Default 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
    Sampriti Guest

  2. #2

    Default Re: Session end event fires but it is not executing code

    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" <sudha_smailcity.com> wrote in message
    news:0f5001c33c06$b1d85140$a601280aphx.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

    Marina Guest

  3. #3

    Default Re: Session end event fires but it is not executing code

    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" <sudha_smailcity.com> wrote in message
    news:0f5001c33c06$b1d85140$a601280aphx.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

    George Durzi Guest

  4. #4

    Default Re: Session end event fires but it is not executing code

    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" <sudha_smailcity.com> wrote in message
    news:05ba01c33c22$aef3be30$a101280aphx.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" <sudha_smailcity.com> wrote in message
    > >news:0f5001c33c06$b1d85140$a601280aphx.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
    > >
    > >
    > >.
    > >

    Marina Guest

  5. #5

    Default Re: Session end event fires but it is not executing code

    (insufficient) permissions on the file..


    "Sampriti" <sudha_smailcity.com> wrote in message
    news:0f5001c33c06$b1d85140$a601280aphx.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

    Rad Guest

Similar Threads

  1. Event Fires after CreateChildControls
    By John Bankhead in forum ASP.NET Building Controls
    Replies: 1
    Last Post: July 18th, 02:38 PM
  2. Custom control fires event but ignores some code in the code behind file
    By recoil@community.nospam in forum ASP.NET Building Controls
    Replies: 0
    Last Post: March 8th, 05:17 PM
  3. ItemCommand Event fires twice
    By Jonas Nilsson in forum ASP.NET General
    Replies: 3
    Last Post: August 1st, 09:19 AM
  4. asp:textbox_TextChanged event no longer fires???
    By Kathy Burke in forum ASP.NET General
    Replies: 2
    Last Post: July 18th, 02:38 PM
  5. Page Load Event Fires Twice
    By Bob Barrows in forum ASP
    Replies: 6
    Last Post: July 10th, 09:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139