Reputation: 4192
I would like to ask you this question because I am a bit stuck with it .
I'm wondering why when I connect thanks to my login form, and when I am on my default page, after 1h staying connected, it disconnects and goes back to the login page.
This is my actual webconfig .
<configuration>
<configSections>
</configSections>
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString='Data Source=.\SQLEXPRESS; AttachDbFilename = "C:\Users\Maxime\Documents\Visual Studio 2010\Projects\ClientPortal\ApplicationUI\Website\ClientPortal\App_Data\DataUi.mdf";Integrated Security=True;User Instance=True'
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<pages validateRequest="false" />
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH">
</forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
<sessionState cookieless="false"/>
<httpRuntime maxRequestLength="1048576"/>
</system.web>
<appSettings>
<add key="FolderPath" value="uploads" />
</appSettings>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</configuration>
Should I put something else in the web config to disable this ?
It's a bit annoying ..
Upvotes: 0
Views: 818
Reputation: 483
this is a small javascript i'm using to avoid session to expire
<script type="text/javascript">
PingAspToKeepSession();
function PingAspToKeepSession() {
var url = "KeppSession.aspx";
var httpOb = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
httpOb.open("POST", url, true);
httpOb.send("");
window.setTimeout("PingAspToKeepSession();", 60000); // every 60 seconds
}
</script>
Upvotes: 1
Reputation: 1705
In the forms tag you need to add slidingExpiration=true
so that if the user is active within the hour the user won't be logged out. The reason they get logged out is because the session times out and by using sliding expiration the session will be extended for the session time each time the user makes a request.
Upvotes: 1
Reputation: 898
You are using the ASP.Net forms authentication. The default timeout for which is 30min (half an hour) I am surprised it lets you idle for an hour.
use the following code to control the timeout period.
<system.web>
<authentication mode="Forms">
<forms timeout="50000000"/>
</authentication>
Upvotes: 4