diff --git a/Site/Security/Login.aspx.cs b/Site/Security/Login.aspx.cs index d4b5f6a3..75d0141a 100644 --- a/Site/Security/Login.aspx.cs +++ b/Site/Security/Login.aspx.cs @@ -93,7 +93,14 @@ namespace Swarmops.Pages.Security { DashboardMessage.Set (String.Format(Resources.Pages.Security.Login_AsOpenLedgers, organizationOpenLedgers.Name)); FormsAuthentication.SetAuthCookie(Authority.FromLogin (Person.FromIdentity (Person.OpenLedgersIdentity), organizationOpenLedgers).ToEncryptedXml(), true); - Response.Redirect (@"/Ledgers/Balance"); + if (HttpContext.Current.Request["ReturnUrl"] == "/") + { + Response.Redirect(@"/Ledgers/Balance"); + } + else + { + Response.Redirect(HttpContext.Current.Request["ReturnUrl"]); // Returns to the requested URL with auth cookie set + } } // Check for SSL and force it