Solved

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

Posted on 2004-10-07
3
1,020 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

810 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