wazir khan ahmadzai wrote:
if (Session["admin"].ToString().Trim() != "" || Session["admin"] != null)
This will always be true. Actually, it will blow up if Session["admin"] is null, because of the order you place it in, but if it were to not blow up, then if the string = "", then it won't equal null, and vice versa. Therefore, this code will either blow up, or always succeed.
The error message means the value is null, and therefore blowing up.
You should learn to use a debugger, and also read a basic book on programming because you are playing with reasonably complex concepts ( although not rocket science ) and you couldn't work out the most basic error from a clear error message. The other reply you got was also absolute nonsense.