Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Session times out in less time than I set

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gnewsgroup - 18 Apr 2008 19:59 GMT
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.GetRedirectUrl(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.
bruce barker - 18 Apr 2008 20:47 GMT
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 am using forms authentication for my web application.
>
[quoted text clipped - 29 lines]
>
> What do you think is causing the problem?  Thank you.
gnewsgroup - 18 Apr 2008 21:35 GMT
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> 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.
gnewsgroup - 24 Apr 2008 23:13 GMT
On Apr 18, 3:47 pm, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> 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.
gnewsgroup - 25 Apr 2008 16:53 GMT
> On Apr 18, 3:47 pm, bruce barker
>
[quoted text clipped - 20 lines]
>
> 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.
gnewsgroup - 25 Apr 2008 17:55 GMT
> > On Apr 18, 3:47 pm, bruce barker
>
[quoted text clipped - 34 lines]
>
> Thank you.

Does it help to change the timeout values in processModel element?
gnewsgroup - 25 Apr 2008 22:44 GMT
> > > On Apr 18, 3:47 pm, bruce barker
>
[quoted text clipped - 36 lines]
>
> 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.
gnewsgroup - 01 May 2008 16:07 GMT
> > > > On Apr 18, 3:47 pm, bruce barker
>
[quoted text clipped - 57 lines]
>
> 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.
David A. Rodriguez - 02 May 2008 07:05 GMT
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 Apr 18, 3:47 pm, bruce barker
>>
[quoted text clipped - 65 lines]
> using the same web.config.  Any idea what might be giving me this
> trouble on the production server?  Thank you.
gnewsgroup - 02 May 2008 14:10 GMT
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.