public void OnGet() { DirectoryMethods dirMethods = new DirectoryMethods(); Username = HttpContext.Session.GetString("Username"); if (RouteData.Values["searchQuery"] != null) { SearchQuery = RouteData.Values["searchQuery"].ToString(); GroupDetails = dirMethods.GetADGroupDetails(SearchQuery); GroupMembers = GroupDetails.GroupObjectsNames; MemberTypes = new List <string>(); foreach (ADGroupObject m in GroupDetails.GroupObjects) { MemberTypes.Add(m.ObjectTypeString); } string Domain = HttpContext.Session.GetString("Domain"); ADActiveUserList = new DirectoryMethods().GetADUserList(Domain); } else { Console.WriteLine("string was empty or null"); } }