SessionLifetime config setting

main
Inga 🏳‍🌈 14 years ago
parent 4feb35dad0
commit c1e0d60315
  1. 2
      Builder/IISMainHandler/build.txt
  2. 3
      Common/Config.cs
  3. 2
      IISMainHandler/WebContext.cs
  4. 2
      IISMainHandler/handlers/request/LoginHandler.cs

@ -41,6 +41,8 @@ namespace FLocal.Common {
public readonly int MinPostId;
public readonly int SessionLifetime;
protected Config(NameValueCollection data) : base(data) {
this.InitTime = DateTime.Now.ToLongTimeString();
this.mainConnection = new MySQLConnector.Connection(data["ConnectionString"], MySQLConnector.PostgresDBTraits.instance);
@ -58,6 +60,7 @@ namespace FLocal.Common {
this.AdditionalHosts = new HashSet<string>(from host in data["AdditionalHosts"].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) select host.Trim());
this.CookiesPrefix = data["CookiesPrefix"];
this.MinPostId = int.Parse(data["MinPostId"]);
this.SessionLifetime = int.Parse(data["SessionLifetime"]);
}
public static void Init(NameValueCollection data) {

@ -144,7 +144,7 @@ namespace FLocal.IISHandler {
session.updateLastActivity(lastUrl);
HttpCookie newCookie = this.createCookie(Config.instance.CookiesPrefix + "_session");
newCookie.Value = session.sessionKey;
newCookie.Expires = DateTime.Now.AddDays(3);
newCookie.Expires = DateTime.Now.AddSeconds(Config.instance.SessionLifetime);
this.httpresponse.AppendCookie(newCookie);
this.session = session;
} catch(NotFoundInDBException) {

@ -45,7 +45,7 @@ namespace FLocal.IISHandler.handlers.request {
HttpCookie sessionCookie = context.createCookie(Config.instance.CookiesPrefix + "_session");
sessionCookie.Value = session.sessionKey;
sessionCookie.Expires = DateTime.Now.AddDays(3);
sessionCookie.Expires = DateTime.Now.AddSeconds(Config.instance.SessionLifetime);
context.httpresponse.AppendCookie(sessionCookie);
context.session = session;

Loading…
Cancel
Save