Hi if your div is at server side control (runat=server) then you should take care of this solution.
if(session["NAME"]!=null)
div.visible=true;
else
div.visible=false;
and if your div is at client side control then you should take care of this solutions.
<script type="text/javascript">
function OnLoad()
{
var username = '<%= Session["UserName"] %>';
if(username != null)
document.getelementByID("div").style.display="none";
else
document.getelementByID("div").style.display="block";
}
</script>