From e2bb88172efeff7e3f770f07a72d42c20b552ab1 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 18 Apr 2015 13:04:20 +0200 Subject: [PATCH] Fix 1 to now-invalid auth cookies --- Site5/App_Code/ControlV5Base.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Site5/App_Code/ControlV5Base.cs b/Site5/App_Code/ControlV5Base.cs index af82e010..37d83949 100644 --- a/Site5/App_Code/ControlV5Base.cs +++ b/Site5/App_Code/ControlV5Base.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Web; +using System.Web.Security; using System.Web.UI; using Swarmops.Logic.Cache; using Swarmops.Logic.Security; @@ -32,7 +33,17 @@ public class ControlV5Base : UserControl protected override void OnInit (EventArgs e) { - this._authority = CommonV5.GetAuthenticationDataAndCulture (HttpContext.Current).Authority; + try + { + this._authority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority; + } + catch (Exception) + { + // if this fails FOR WHATEVER REASON then we're not authenticated + this._authority = null; + FormsAuthentication.SignOut(); + Response.Redirect ("/"); + } base.OnInit (e); }