Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
CSS
Hi All,

I am experiencing an issue with my hosted application that is throwing Authentication Failed Exception. Here is a background of the issue:

Our application is hosted on two servers with Load balancer in the front. Obviously, we had to manage the session outside the servers and we chose SQL server to do this job.

Our timeout value is set to 60 minutes. But, if I leave my application in idle state for about 20 minutes and then click on a link or try to navigate to another page, it registers a 401 exception as below and returns to the login page. Please find the fiddler response below:

Please help me with some insight into this issue. Can there be scenarios where a session is cleared off the SQL server before the timeout interval? I checked in the table for the session and the timeout field there is displaying correct data

HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/7.5
jsonerror: true
X-Powered-By: ASP.NET
Date: Thu, 19 Jun 2014 07:00:55 GMT
Content-Length: 105

{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}
Thank you.

Regards,

Krishna Chaduvula
Posted
Comments
DamithSL 25-Jun-14 0:50am    
where you set timeout as 60?
Krishna Chaduvula 25-Jun-14 7:37am    
<sessionstate
mode="SQLServer"
="" sqlconnectionstring="data
source=ULCAREDEV;user id=userid;password=password" cookieless="false" timeout="60">

1 solution

Assuming that you are using Default implementation of Session stored on SQL Server. Please check that the entries in the ASPStateTempSessions table are removed after the related sessions have exceeded their expiration. If it is not removed that check that SQL Server Agent is running or not. This expiration mechanism has been implemented as stored procedures/Jobs, DeleteExpiredSessions is the SP that is responsible for expiring the session.

Usually we configure session state in following way in Web.Config

XML
<sessionstate>
            mode="SQLServer"
            sqlConnectionString="data source=127.0.0.1;user id=<username>;password=<strongpassword>"
            cookieless="false" 
            timeout="60" 
    />
	</strongpassword></username></sessionstate>
 
Share this answer
 
Comments
Krishna Chaduvula 25-Jun-14 3:44am    
Hi Syed,

Thank you for the swift response. I think you got my problem wrong. I want a timeout after 60 min, but its happening within 20 odd min.

Thank you.

Regards,
Krishna Chaduvula

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900