How to allow longer time before timeout error?

A

Andrew

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.
 
L

Leon Mayne

Andrew said:
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)
 
L

Leon Mayne

Leon Mayne said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top