null reference exception in site.master.cs
<p>i got "Object reference not set to an instance of an object". in my master page code behind. how to solve this?</p>

<p>Site.Master.Cs</p>

<pre><code> protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["IsLogin"] == "1")
        {
            ((HyperLink)HeadLoginView.FindControl("Login")).Visible = false;
            ((HyperLink)HeadLoginView.FindControl("Logout")).Visible = true;
        }
        else
        {
            ((HyperLink)HeadLoginView.FindControl("Login")).Visible = true;
            ((HyperLink)HeadLoginView.FindControl("Logout")).Visible = false;
        }
    }
</code></pre>

<p>Site.master</p>

<pre><code> &lt;asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"&gt;
                &lt;AnonymousTemplate&gt;
                    [ &lt;a href="~/Default.aspx" id="HeadLoginStatus" runat="server"&gt;Log In&lt;/a&gt; ]
                     [ &lt;a href="~/Logout.aspx" id="HeadLoginStass" runat="server"&gt;Log Out&lt;/a&gt; ]
                &lt;/AnonymousTemplate&gt;
</code></pre>
