I added the following code:
The first line isn't required, I only added it so that the option was configurable with a setting in the config file.
if (ConfigurationManager.AppSettings["StartLoginPage"] != null && Convert.ToBoolean(ConfigurationManager.AppSettings["StartLoginPage"]))
if (!Context.User.Identity.IsAuthenticated)
Response.Redirect("~/Account/Login.aspx");
inside the if (!Page.IsPostBack) conditional block.The first line isn't required, I only added it so that the option was configurable with a setting in the config file.