title: ASP.NET Check if LoginName is null
body: <p>I have a web application on VS2005 C# and I would want to check if user is logged in the application.</p>
  
  <p>Currently I am trying </p>
  
  <pre><code>if (LoginName.Equals(null))
  {
      Response.Redirect("/Project/Login.aspx");
  }
  </code></pre>
  
  <p>but I seem to be getting some errors.</p>
  
  <p>Anyone can tell me how I should do it or is there any better ways too check?</p>
  
  <p>Thank you</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>Sorry for being unclear with my question.</p>
  
  <p><code>LoginName</code> is the <em>System.Web.UI.WebControls.LoginName</em>.</p>
  
  <p>The error I am getting is `An object reference is required for the nonstatic field , method or property 'object.Equals(object)'</p>