473,378 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Session times out in less time than I set

I am using forms authentication for my web application.

In web.config, I have this:

<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="120"
name=".ASPXAUTH"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="Default.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false"/>
</authentication>

And in my Login.aspx.cs, I have this:

FormsAuthenticationTicket ticket =
new FormsAuthenticationTicket(1, username, DateTime.Now,
DateTime.Now.AddMinutes(120), false, "userdata");
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie =
new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Add(cookie);
Response.Redirect(FormsAuthentication.GetRedirectU rl(username,
false));

I ran my web app, log in, let it idle for 1 hour 40 minutes, then I
click on something, but was logged out. It's not 2 hours yet.

What do you think is causing the problem? Thank you.
Jun 27 '08 #1
9 1802
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.
-- bruce (sqlwork.com)
"gnewsgroup" wrote:
I am using forms authentication for my web application.

In web.config, I have this:

<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="120"
name=".ASPXAUTH"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="Default.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false"/>
</authentication>

And in my Login.aspx.cs, I have this:

FormsAuthenticationTicket ticket =
new FormsAuthenticationTicket(1, username, DateTime.Now,
DateTime.Now.AddMinutes(120), false, "userdata");
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie =
new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Add(cookie);
Response.Redirect(FormsAuthentication.GetRedirectU rl(username,
false));

I ran my web app, log in, let it idle for 1 hour 40 minutes, then I
click on something, but was logged out. It's not 2 hours yet.

What do you think is causing the problem? Thank you.
Jun 27 '08 #2
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.

-- bruce (sqlwork.com)
Ha, very interesting. Yes, I use inproc mode. Is this 30 min default
changeable in web.config or machine.config? Also, if this documented
by MSDN? Can I get a reference to the doc? Thank you very much.
Jun 27 '08 #3
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.

-- bruce (sqlwork.com)
I have been trying hard to find any documentation about this, but
could not find any.
I've tried InProc mode, and since the result does not seem to be
reliable, then I tried using SQLServer mode.

But, still a session can be lost shorter than the timeout I set in
web.config.

Please be advised, that when I tested it, I tried not to touch any
file in my web application.

Any idea why this happens? And is there a way to keep a session alive
for 2 to 3 hours even if no one is using the web application?

Please share your wisdom and thank you very much.
Jun 27 '08 #4
On Apr 24, 6:13 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 18, 3:47 pm, bruce barker

<brucebar...@discussions.microsoft.comwrote:
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.
-- bruce (sqlwork.com)

I have been trying hard to find any documentation about this, but
could not find any.
I've tried InProc mode, and since the result does not seem to be
reliable, then I tried using SQLServer mode.

But, still a session can be lost shorter than the timeout I set in
web.config.

Please be advised, that when I tested it, I tried not to touch any
file in my web application.

Any idea why this happens? And is there a way to keep a session alive
for 2 to 3 hours even if no one is using the web application?

Please share your wisdom and thank you very much.
Anyone out there has a clue? I feel helpless with the session
timeout.

It looks like if the timeout value I set for Forms Authentication and
sessionState in web.config is smaller than 30 minutes, the system
honors the timeout setting

But if I set the value to be much bigger, then whether I use InProc or
SQLServer, my session always timeout 30 minutes or so.

Any idea how I can keep the session alive for 2 to 3 hours?

Thank you.
Jun 27 '08 #5
On Apr 25, 11:53 am, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 24, 6:13 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.
-- bruce (sqlwork.com)
I have been trying hard to find any documentation about this, but
could not find any.
I've tried InProc mode, and since the result does not seem to be
reliable, then I tried using SQLServer mode.
But, still a session can be lost shorter than the timeout I set in
web.config.
Please be advised, that when I tested it, I tried not to touch any
file in my web application.
Any idea why this happens? And is there a way to keep a session alive
for 2 to 3 hours even if no one is using the web application?
Please share your wisdom and thank you very much.

Anyone out there has a clue? I feel helpless with the session
timeout.

It looks like if the timeout value I set for Forms Authentication and
sessionState in web.config is smaller than 30 minutes, the system
honors the timeout setting

But if I set the value to be much bigger, then whether I use InProc or
SQLServer, my session always timeout 30 minutes or so.

Any idea how I can keep the session alive for 2 to 3 hours?

Thank you.
Does it help to change the timeout values in processModel element?
Jun 27 '08 #6
On Apr 25, 12:55 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 25, 11:53 am, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 24, 6:13 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.
-- bruce (sqlwork.com)
I have been trying hard to find any documentation about this, but
could not find any.
I've tried InProc mode, and since the result does not seem to be
reliable, then I tried using SQLServer mode.
But, still a session can be lost shorter than the timeout I set in
web.config.
Please be advised, that when I tested it, I tried not to touch any
file in my web application.
Any idea why this happens? And is there a way to keep a session alive
for 2 to 3 hours even if no one is using the web application?
Please share your wisdom and thank you very much.
Anyone out there has a clue? I feel helpless with the session
timeout.
It looks like if the timeout value I set for Forms Authentication and
sessionState in web.config is smaller than 30 minutes, the system
honors the timeout setting
But if I set the value to be much bigger, then whether I use InProc or
SQLServer, my session always timeout 30 minutes or so.
Any idea how I can keep the session alive for 2 to 3 hours?
Thank you.

Does it help to change the timeout values in processModel element?
Hmm, looks like no one has a clue about this issue. I have been
testing this session timeout like crazy, and I am not getting
predictable, consistent results.

You guys never have any issue with session timeout? Our client would
like to keep a session alive for at least 2 hours, and it seems that
we cannot make this happen. It always timeout 30 minutes or so, no
matter what I try.

I've tried InProc, I've tried SqlServer state modes. I've modified
the processModel element of machine.config like so:

<processModel enable="true" idleTimeout="120" shutdownTimeout="120"
timeout="120" autoConfig="false" />

None of these helped.

I am using forms authentication, and I always set the same value for
forms authentication timeout and session timeout in web.config.

Ok, does any guru have a clue? Any hint is highly appreciated.
Jun 27 '08 #7
On Apr 25, 5:44 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 25, 12:55 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 25, 11:53 am, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 24, 6:13 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
asp.net has an application idle (shutdownTimeout) setting defaulted to 30
minues. if noone hits the site and you use inproc sessions, then they will be
lost at the thirty minute mark.
-- bruce (sqlwork.com)
I have been trying hard to find any documentation about this, but
could not find any.
I've tried InProc mode, and since the result does not seem to be
reliable, then I tried using SQLServer mode.
But, still asessioncan be lost shorter than thetimeoutIsetin
web.config.
Please be advised, that when I tested it, I tried not to touch any
file in my web application.
Any idea why this happens? And is there a way to keep asessionalive
for 2 to 3 hours even if no one is using the web application?
Please share your wisdom and thank you very much.
Anyone out there has a clue? I feel helpless with thesession
>timeout.
It looks like if thetimeoutvalue Isetfor Forms Authentication and
sessionState in web.config is smaller than 30 minutes, the system
honors thetimeoutsetting
But if Isetthe value to be much bigger, then whether I use InProc or
SQLServer, mysessionalwaystimeout30 minutes or so.
Any idea how I can keep thesessionalive for 2 to 3 hours?
Thank you.
Does it help to change thetimeoutvalues in processModel element?

Hmm, looks like no one has a clue about this issue. I have been
testing thissessiontimeoutlike crazy, and I am not getting
predictable, consistent results.

You guys never have any issue withsessiontimeout? Our client would
like to keep asessionalive for at least 2 hours, and it seems that
we cannot make this happen. It alwaystimeout30 minutes or so, no
matter what I try.

I've tried InProc, I've tried SqlServer state modes. I've modified
the processModel element of machine.config like so:

<processModel enable="true" idleTimeout="120" shutdownTimeout="120"timeout="120" autoConfig="false" />

None of these helped.

I am using forms authentication, and I alwayssetthe same value for
forms authenticationtimeoutandsessiontimeoutin web.config.

Ok, does any guru have a clue? Any hint is highly appreciated.
OK, it seems that the session timeout setting in my web.config works
fine on my development machine. But on my client's production server,
session always timeout in 20 minutes. I gave it a few tests, at 19
minutes, it is alive, but at 21 minutes, it is dead. However, I am
using the same web.config. Any idea what might be giving me this
trouble on the production server? Thank you.
Jun 27 '08 #8
I cannot remember at the top of my head but will try to find for you
tommorow, but I believe you can set the session time outs in IIS in the
properties of the website. I will try to look for that for you
tommorow. I am not at work is why.

On 2008-05-01 10:07:42 -0500, gnewsgroup <gn********@gmail.comsaid:
On Apr 25, 5:44 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
>On Apr 25, 12:55 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
>>On Apr 25, 11:53 am, gnewsgroup <gnewsgr...@gmail.comwrote:
>>>On Apr 24, 6:13 pm, gnewsgroup <gnewsgr...@gmail.comwrote:
>>>>On Apr 18, 3:47 pm, bruce barker
>>>><brucebar...@discussions.microsoft.comwrote:
>asp.net has an application idle (shutdownTimeout) setting defaulted to 30
>minues. if noone hits the site and you use inproc sessions, then they will be
>lost at the thirty minute mark.
>>>>>-- bruce (sqlwork.com)
>>>>I have been trying hard to find any documentation about this, but
could not find any.
I've tried InProc mode, and since the result does not seem to be
reliable, then I tried using SQLServer mode.
>>>>But, still asessioncan be lost shorter than thetimeoutIsetin
web.config.
>>>>Please be advised, that when I tested it, I tried not to touch any
file in my web application.
>>>>Any idea why this happens? And is there a way to keep asessionalive
for 2 to 3 hours even if no one is using the web application?
>>>>Please share your wisdom and thank you very much.
>>>Anyone out there has a clue? I feel helpless with thesession
timeout.
>>>It looks like if thetimeoutvalue Isetfor Forms Authentication and
sessionState in web.config is smaller than 30 minutes, the system
honors thetimeoutsetting
>>>But if Isetthe value to be much bigger, then whether I use InProc or
SQLServer, mysessionalwaystimeout30 minutes or so.
>>>Any idea how I can keep thesessionalive for 2 to 3 hours?
>>>Thank you.
>>Does it help to change thetimeoutvalues in processModel element?

Hmm, looks like no one has a clue about this issue. I have been
testing thissessiontimeoutlike crazy, and I am not getting
predictable, consistent results.

You guys never have any issue withsessiontimeout? Our client would
like to keep asessionalive for at least 2 hours, and it seems that
we cannot make this happen. It alwaystimeout30 minutes or so, no
matter what I try.

I've tried InProc, I've tried SqlServer state modes. I've modified
the processModel element of machine.config like so:

<processModel enable="true" idleTimeout="120"
shutdownTimeout="120"timeout="120" autoConfig="false" />

None of these helped.

I am using forms authentication, and I alwayssetthe same value for
forms authenticationtimeoutandsessiontimeoutin web.config.

Ok, does any guru have a clue? Any hint is highly appreciated.

OK, it seems that the session timeout setting in my web.config works
fine on my development machine. But on my client's production server,
session always timeout in 20 minutes. I gave it a few tests, at 19
minutes, it is alive, but at 21 minutes, it is dead. However, I am
using the same web.config. Any idea what might be giving me this
trouble on the production server? Thank you.

Jun 27 '08 #9
On May 2, 2:05 am, David A. Rodriguez <iimme...@mac.comwrote:
I cannot remember at the top of my head but will try to find for you
tommorow, but I believe you can set the session time outs in IIS in the
properties of the website. I will try to look for that for you
tommorow. I am not at work is why.
Thank you. I know that we can set the session timeout with the IIS
control panel. But some gurus on this board told me that that one is
only meant for classic ASP. My web application is .net 2.0.

Well, with IIS control panel, we do have the ability to set the
timeout for .net web application as well, but Juan Libre told me that
it'll be overriden by whatever value I set in web.config anyway.
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
0
by: Sameer | last post by:
Hello All, I have a simple JSP which looks like this <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <%@ page session="true"%> <HTML> <HEAD> <meta HTTP-EQUIV="refresh"...
7
by: Stephanie Stowe | last post by:
http://www.aspfaq.com/show.asp?id=2078 I got my butt whooped over at asp.net group the other day with an offhanded reference to the unreliability of session on end. I have been told that in ASP...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
4
by: Sugapablo | last post by:
When users log into my website, they're given session variables: Session("userid") = Let's say I have 7 users logged in. Is there a way to somehow loop through all the sessions and return all...
1
by: bajopalabra | last post by:
hi if i disable session state... how can i identify the user session ??? and, assuming that i generate my own "session id" for each login carrying it along the requests... how can i, latter,...
15
by: dee | last post by:
Hi, What is the maximum number of minutes for Session timeout that I can specify in web.config? Thanks. Dee
8
by: Nacho | last post by:
Hello people I have the following problem I have a private area in my site. The user enters the username and password, then clicks "enter" and the session is created and also a session...
3
by: DNB | last post by:
I did post this message in C# group also... I would like to know what you guys think is the best way to access data: Asp.Net session vs. Database Queries. In our application we are using...
9
by: MC | last post by:
I would like to display a timer in the corner of the page that shows the user how many minutes:seconds till the session times out. Are there any good examples out there? Google has again failed...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.