My application needs to show menus to five types of different users. For example, Administrator user can see all menus but Gestor user can see just one menu.

login's screen has the code below:

Code
namespace Admin {
Code
 public partial class Login : System.Web.UI.Page
Code
 {
Code
   protected void Page_Load(object sender, EventArgs e)
Code
   {
Code
   }
Code
   protected void btnLogin_Click(object sender, EventArgs e)
Code
   {
Code
      DataSet ds = Login.ValidarLogin(txtUserID.Text, txtPassword.Text);
Code
      DataTable dt = ds.Tables[0];
Code
      if (dt.Rows.Count == 0)
Code
      { messageBox.ShowMessage("Usuário ou Senha incorretos!!");
Code
      }
Code
      else
Code
      {  this.Session["UserID"] = dt.Rows[0]["Id"].ToString();
Code
         this.Session["UserName"] = dt.Rows[0]["Username"].ToString();
Code
         this.Session["Privileges"] = dt.Rows[0]["Permissao"].ToString();
Code
         Response.Redirect("Principal.aspx");
Code
      }
Code
    }
Code
  }
Code
}

Code
The class that controls and shows the menus is this:
C#
namespace Teach
{
   public partial class UCNavigation : System.Web.UI.UserControl
   {
      public Usuario usuario
      {
                     get
         {
            return HttpContext.Current.Session["Usuario"] as             Usuario; }
          set
         {   HttpContext.Current.Session["Usuario"] = value; }
   }

   private void Page_Load(object sender, EventArgs e)
   {
                                             bool Logged = paginaBase.LoggedIn(Session);

      if (this.lnkChangePassword.Enabled)
      {
         this.lnkChangePassword.CssClass = "izq";
      }
      else { this.lnkChangePassword.CssClass = "izqDesactivado"; }

      Page.ClientScript.RegisterStartupScript(Page.GetType(),       "tttt", "ocultarEnlaces(" + Logged.ToString().ToLower() +       ");", true); this.divLogin.Visible = !Logged;

       if (Logged)
      {
         if (this.usuario.Permissao == Usuario.Permissoes.Gestor)
         {
            this.linkListGestor.Visible = false;
         }
         
Code
         else if (this.usuario.Permissao == Usuario.Permissoes.Concedente)
Code
         {
Code
            this.linkListConvenio.Visible = false;
Code
            this.linkListConcedente.Visible = false;
Code
            this.linkListPagamento.Visible = false;
Code
            this.linkListMeta.Visible = false; }
            this.lnkHome.CssClass = "izq";
C#
            this.lnkLogout.CssClass = "izq";
            this.linkListGestor.CssClass = "izqDos";             this.linkListProponente.CssClass = "izqDos";             this.linkListConvenente.CssClass = "izqDos";             this.linkListConvenio.CssClass = "izqDos";             this.linkListConcedente.CssClass = "izqDos";             this.linkListInterveniente.CssClass = "izqDos";             this.linkListFavorecido.CssClass = "izqDos";             this.linkListDesembolso.CssClass = "izqDos";             this.linkListMeta.CssClass = "izqDos";             this.linkListPagamento.CssClass = "izqDos";             this.linkListBemProduzido.CssClass = "izqDos";
       }
   }
   protected override void OnInit(EventArgs e)
   {
      this.InitializeComponent(); base.OnInit(e);
   }

   private void InitializeComponent()
   {
         base.Load += new EventHandler(this.Page_Load);
   }
 }

}

Code
This class calls another method:
Code
public static bool LoggedIn(HttpSessionState Session)
Code
{
Code
      bool Result = true;
Code
      if (Session["UserName"] == null)
Code
      { Result = false;
Code
      }
Code
      if (Session["UserID"] == null)
Code
      { Result = false;
Code
      }
Code
      if (Session["Privileges"] == null)
Code
      { Result = false;
Code
      }
Code
      return Result;
Code
}

The problem happens in this lines:

Code
if (this.usuario.Permissao == Usuario.Permissoes.Gestor)
Code
and
Code
else if (this.usuario.Permissao == Usuario.Permissoes.Concedente)
Code
VB.NET
Source error is :  [NullReferenceException: Object reference not set to an instance of an object.]
Is there a way where I can catch the attribute 'Permissao' combined to user from database and compare it in my logic condition to show the menus to the users?