public void OnGet() { VerifyLogin(); ProductCount = catalog.CountProduct(); OrderCount = ocatalog.OrderCount(); Money = ocatalog.Money(); void VerifyLogin() { if (HttpContext.Session.GetInt32("Login") != null) { validUser = (int)HttpContext.Session.GetInt32("Login"); } else { validUser = 0; RedirectToPage("Login"); } if (HttpContext.Session.GetString("Email") != null) { email = HttpContext.Session.GetString("Email"); } else { email = null; RedirectToPage("Login"); } } }