How to allow longer time before timeout error?

Discussion in 'ASP .Net' started by Andrew, Jan 21, 2008.

  1. Andrew

    Andrew Guest

    Hello, friends,

    Our have a .net 2003 website using c#.net.

    We want to let our users to have longer timeout time, and we did in
    Web.config:

    <authentication mode="Forms">
    <forms loginUrl="login.aspx" protection="All" name="Cookie"
    slidingExpiration="true" timeout="120" />
    </authentication>

    hopefully this would allow 2 hours before timeout.

    However, it turned out users did not get that long timeout, rather they
    still got timeout error like before.

    Any reasons and how to fix it? Thanks.
     
    Andrew, Jan 21, 2008
    #1
    1. Advertising

  2. Andrew

    Leon Mayne Guest

    "Andrew" <> wrote in message
    news:...
    > Hello, friends,
    >
    > Our have a .net 2003 website using c#.net.
    >
    > We want to let our users to have longer timeout time, and we did in
    > Web.config:
    >
    > <authentication mode="Forms">
    > <forms loginUrl="login.aspx" protection="All" name="Cookie"
    > slidingExpiration="true" timeout="120" />
    > </authentication>
    >
    > hopefully this would allow 2 hours before timeout.
    >
    > However, it turned out users did not get that long timeout, rather they
    > still got timeout error like before.
    >
    > Any reasons and how to fix it? Thanks.


    The session may be timing out before the authentication token. Set the
    session timeout as well:
    <sessionState timeout="120" />
    (Check that properly, as you may have to specify other settings)
     
    Leon Mayne, Jan 21, 2008
    #2
    1. Advertising

  3. Andrew

    Leon Mayne Guest

    "Leon Mayne" <> wrote in message
    news:...
    > "Andrew" <> wrote in message
    > news:...
    >> Hello, friends,
    >>
    >> Our have a .net 2003 website using c#.net.
    >>
    >> We want to let our users to have longer timeout time, and we did in
    >> Web.config:
    >>
    >> <authentication mode="Forms">
    >> <forms loginUrl="login.aspx" protection="All" name="Cookie"
    >> slidingExpiration="true" timeout="120" />
    >> </authentication>
    >>
    >> hopefully this would allow 2 hours before timeout.
    >>
    >> However, it turned out users did not get that long timeout, rather they
    >> still got timeout error like before.
    >>
    >> Any reasons and how to fix it? Thanks.

    >
    > The session may be timing out before the authentication token. Set the
    > session timeout as well:
    > <sessionState timeout="120" />
    > (Check that properly, as you may have to specify other settings)


    P.S. You'll probably still get problems, as the session will often timeout
    even though the authentication token is still valid. To fix this you need to
    add some code in the Session_Start function in your Global.asax which will
    check if the user is authenticated when a new session is starting, and if so
    create all the user's session details again, e.g.

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' Check to see if the user is already authenticated
    If User.Identity.IsAuthenticated = True Then
    ' The session has expired before the forms authentication did
    ' Create session variables again for the user
    Session("CurrentUser") = New
    Person(CInt(Request.Cookies("UserId").Value))
    End If
    End Sub

    If you do this then you don't have to modify your session timeout.
     
    Leon Mayne, Jan 21, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff
    Replies:
    2
    Views:
    986
    clintonG
    Sep 19, 2006
  2. Adrian Casey
    Replies:
    1
    Views:
    495
    Gabriel Genellina
    May 25, 2011
  3. Ryan Taylor
    Replies:
    1
    Views:
    717
    Ryan Taylor
    Sep 9, 2004
  4. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,351
    Brian Candler
    Oct 6, 2004
  5. Mikel Lindsaar
    Replies:
    2
    Views:
    164
    Mikel Lindsaar
    Aug 2, 2008
Loading...

Share This Page