Advertisement

11.15.2007 at 04:43PM PST, ID: 22964662
[x]
Attachment Details

Forms authentication timing out prematurely

Asked by Oxfam_Australia in Programming for ASP.NET, Visual Studio .NET 2005, .NET Framework 2.0

Tags: authentication, out, timing, forms

Hi folks.  I'm building a site in VB.NET using forms authenication as laid out in my .NET book for newbies.  Everything seems to work fine except that my session times out prematurely - the site only needs to be inactive for a minute or two before it logs me out.  I've got the timeout set to 60 minutes.  My code is as follows:

web.config
--------------
<system.web>
      <authentication mode="Forms">
            <forms name=".CookieName" loginUrl="login.aspx" defaultUrl="~/default.aspx"  protection="All" timeout="60"/>
      </authentication>
      <authorization>
            <deny users="?"/>
      </authorization>
</system.web>

Then when I process the user login, I simply do the following in the code behind on the login page:

FormsAuthentication.RedirectFromLoginPage(strUsername, False)

I've tried setting the above to "true", but it doesn't seem to make any difference.  Anyway, as I understand it, setting it to "true" simply means that the cookie persists after the browser has been closed.

Other things I've looked into:

1.  The web.config file is not being resaved by anti-virus software - I read somewhere that this often happens, but it's not happening here.
2.  I added the following to web.config under <system.web> with no real idea why it would be different to the setting above:  <sessionState mode="InProc" timeout="60" />
3.  I added a global.asax file and added something to do with timeout on application_start, but it caused a .NET error (unfortunately I can't remember the code that I used and can't seem to reproduce it now).

Does anyone have any ideas?  If you do, would you please give a detailed response as I really don't know what I'm doing.Start Free Trial
 
 
[+][-]11.19.2007 at 04:56PM PST, ID: 20316945

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming for ASP.NET, Visual Studio .NET 2005, .NET Framework 2.0
Tags: authentication, out, timing, forms
Sign Up Now!
Solution Provided By: anoyes
Participating Experts: 1
Solution Grade: B
 
 
[+][-]12.16.2007 at 06:04PM PST, ID: 20482446

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.23.2007 at 05:06PM PST, ID: 20523083

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628