Session end event fires but it is not executing code

Ask a Question related to ASP.NET General, Design and Development.

  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. Similar Questions and Discussions

    1. Event Fires after CreateChildControls
      I have created a C# control that creates its objects within CreateChildControls. One of those objects is a button which I have attached to a...
    2. Custom control fires event but ignores some code in the code behind file
      I do not quite understand the question. I will merely point out that most programming problems happen for a reason. Code works the way it is...
    3. ItemCommand Event fires twice
      Hi! I have a DataList with some linkbuttons, and when i click them the eventhandler fires twice. Is there a way around this?, it's the same...
    4. asp:textbox_TextChanged event no longer fires???
      Hi, I have a textbox control with some typical textchanged event code. It has worked fine, but all of a suddent the event no longer fires when you...
    5. Page Load Event Fires Twice
      This is a classic asp newsgroup. While you may be lucky enough to find a dotnet-savvy person here who can answer your question, you can eliminate...
  3. #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_s@mailcity.com> wrote in message
    news:0f5001c33c06$b1d85140$a601280a@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

    Marina Guest

  4. #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_s@mailcity.com> wrote in message
    news:0f5001c33c06$b1d85140$a601280a@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

    George Durzi Guest

  5. #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_s@mailcity.com> wrote in message
    news:05ba01c33c22$aef3be30$a101280a@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" <sudha_s@mailcity.com> wrote in message
    > >news:0f5001c33c06$b1d85140$a601280a@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
    > >
    > >
    > >.
    > >

    Marina Guest

  6. #5

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

    (insufficient) permissions on the file..


    "Sampriti" <sudha_s@mailcity.com> wrote in message
    news:0f5001c33c06$b1d85140$a601280a@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

    Rad Guest

Posting Permissions

  • You may not post new threads
  • You may 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