Solved

session_end() of global.aspx does not execute on session.abandon() in vb.net code behind

Posted on 2004-10-07
3
1,006 Views
Last Modified: 2008-02-20
hello everybody,

friends i am working on an application where i have to reset a flag in databse by a sql query whenever the session of a user is destroyed due to timeout or proper logout, so i used session.abandon() command in vb.net code behind and write the following code in session_en() function of global.aspx .


-----------------------------------------------------------------------------------------------
 Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)

        Dim connLogin As SqlConnection = New SqlConnection
        connLogin = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
        If connLogin.State = ConnectionState.Closed Then
            connLogin.Open()
            Dim x = 17 'Session("IID")
            Dim cmdUpdate As SqlCommand = New SqlCommand("update status set Flag='1' where IID='" & x & "'", connLogin)
            cmdUpdate.ExecuteNonQuery()
            connLogin.Close()
            Context.Response.Write("database restored")
        Else
            Context.Response.Write("database cant be restored")
        End If

End Sub
-----------------------------------------------------------------------------------------------------

but any part of this function is not executed at all whenever session expires.

i have also given the session timeout value to 2 minutes in web.config file.

please help that exactly when and how this function can be executed as i need it at many more places.

thanks in advance.
0
Comment
Question by:anugrah
3 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 12248209
0
 

Accepted Solution

by:
softsolvers earned 90 total points
ID: 12256024
you can't see any context.response.write("string ")   output in session_end() otherwise your function is working fine . i have checked it .

thanks
0
 
LVL 1

Author Comment

by:anugrah
ID: 12256033
ya , softsolvers , thanks a lot your soluted helped me out of your problem
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now