Hashtable ht = new Hashtable();
FileStream sfs = new FileStream("temp.xml", FileMode.Open, FileAccess.Read);
Hashtable h = new Hashtable();
BinaryFormatter formatter = new BinaryFormatter();
h = (Hashtable)formatter.Deserialize(sfs);
string status = Convert.ToString(h["name"]);
sfs.Close();
if (status == "Admin" || status == "admin")
{
return true;
}
else
{
return false;
}
and Better suggestion:
FileStream sfs = new FileStream("temp.xml", FileMode.Open, FileAccess.Read);
Hashtable h = new Hashtable();
BinaryFormatter formatter = new BinaryFormatter();
h = (Hashtable)formatter.Deserialize(sfs);
string status = Convert.ToString(h["name"]);
sfs.Close();
return (status.ToUpper() == "ADMIN")? true:false