keeping sessions alive throughout

From: Eric Throckmorton (ethrockmorton@neo.rr.com)
Date: 10/02/02


From: "Eric Throckmorton" <ethrockmorton@neo.rr.com>
Date: Wed, 2 Oct 2002 12:37:41 -0400


Hello,

I am using sessions in my login.
I have five of them and some are being used throughout the website.
They are all called from the users table as an integer and stored in a
session.
as the navigation carries on, the sessions start timing out. One in
particular (the userID session), times out the fastest.
It is called on the header.ascx (which is at the top of every page.
I have this in my web.config file:
<system.web>
       <sessionState mode="InProc" cookieless="false" timeout="480" />
 </system.web>
the 480 minutes being 8 hrs. however, i get time out quickly.
the error says: Object not set to the reference of an object. and is
pointing to the header.ascx script where it is calling the username form a
session.

i put the following in the header:
Sub Page_Load(Src As Object, e As EventArgs)
        If not IsPostBack then
        dim connection as new SqlConnection(
"server=000;UID=000;password=000;Database=000" )
        connection.Open ()
        dim sql as string = "getfirstname " & Session("userid").ToString()
        dim command as new SqlCommand (sql, connection)
        dim dr as SQlDataReader = command.ExecuteReader()
        dr.Read()
        Label1.Text = dr("fname").ToString()
        connection.Close()
        Else
        Label1.Text = "Session Ended"
        End If
    End Sub
that cut down on the errors and now where the first name goes it labels
session ended until a page is switched or it times out.

What can i do to prevent the timing out, but still keep the sessions going?

E



Relevant Pages

  • Re: OOP in ASP .Net Pages
    ... Is there a Static type modifier that is session specific. ... Private m_OfficeID As System.String ... Public Property CompanyID() As System.String ... Public Sub New ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: OOP in ASP .Net Pages
    ... I am not sure what you mean, however the good old session is to keep data ... Private m_OfficeID As System.String ... Public Property CompanyID() As System.String ... Public Sub New ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ArrayList in Thread question
    ... be thread safe and it won't throw an exception even when other threads ... guarantee thread safety during enumeration, ... Public Function RegisterClient(ByRef Session As SessionClass, ... Sub ProcessEachMessage ...
    (microsoft.public.dotnet.languages.vb)
  • Re: ArrayList in Thread question
    ... Here is the help information about thread safety for an arraylist: ... ' Create a new worker thread to handle the client session ... Public Function RegisterClient(ByRef Session As SessionClass, ... Sub ProcessEachMessage ...
    (microsoft.public.dotnet.languages.vb)
  • Re: ArrayList in Thread question
    ... be thread safe and it won't throw an exception even when other threads ... ' Create a new worker thread to handle the client session ... Public Function RegisterClient(ByRef Session As SessionClass, ... Sub ProcessEachMessage ...
    (microsoft.public.dotnet.languages.vb)

Quantcast