reader = server.ExecuteReader(CommandType.Text, getPermissionlistQuery, param);
var results = new List<string>();
while (reader.Read())
{
results.Add(reader["permissionName"].ToString());
}
reader.Close();
Session.Add("Permissions", results);
I am adding results to the session, how can I retrieve it in another page.
results is a list of values
var permissionList = Session["Permissions"];
string check = "Create Groups";
if (permissionList.Any(item => item.Equals(check)))
{
// results contains the value in check
}
and I want to check whether the permission is available in the Permission list but the if statement is throwing a error
'object' does not contain a definition for 'Any' and no extension method 'Any' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
UPDATED: Change bottom code to this:
Also, reference: