using this Bromberg's SessionTimeoutControl.dll

dualshock03

Well-known member
Joined
Jan 28, 2007
Messages
105
Programming Experience
1-3
Hello!! hey Guys!, i need help working this session timeOut control..

i downloaded this from Bromberg's article about detecting session timeout redirect control.. I try to referenced the .dll to my solution and use the control from toolbox.

My web app contains a login.aspx, a main.aspx and a timeout.htm page. In the main.aspx i put the SessionTimeoutControl then from its properties, i put the "timeout.htm" value to the RedirectUrl property.

Then from the Web.config file i write down the following codes:



<trace enabled="false"
requestLimit="10"
pageOutput="true"
traceMode="SortByTime"
localOnly="true"/>


<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="true"
timeout="1"/>



That's it but when i try to test the whole application.. try to login then refresh the page at the main.aspx after 1 minute, the timeout.htm does not redirect at all. what am i missing here? maybe some session items? im attaching the .dll file here,, try to check it and reply me.. tnxx..!!!
 

Attachments

  • SessionTimeoutControl.zip
    2.5 KB · Views: 18
The code works, but since the control isn't Visible it isn't rendered, so the code is never executed. This may be a change in ASP.Net since previous version 1.1. Anyway here is the same VB.Net code you can try with the page:
VB.NET:
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs)
    If Context.Session IsNot Nothing Then
        If Context.Session.IsNewSession Then
            Dim sCookieHeader As String = Page.Request.Headers("Cookie")
            If sCookieHeader IsNot Nothing Then
                If sCookieHeader.IndexOf("ASP.NET_SessionId") >= 0 Then
                    If Page.Request.IsAuthenticated Then
                        Page.Response.Redirect("~/somepage.aspx")
                    End If
                End If
            End If                
        End If
    End If
End Sub
You also have to put something in Session for IsNewSession to operate as expected.
 
Back
Top