Asp.net-mvc – check if user is logged in in user control Asp.net MVC

asp.net-mvcuser-controls

how can i check if a user is logged in in user control with asp.net mvc

usually on a view page i use this

<% if (User.Identity.IsAuthenticated) {%>
  //Do something
<% } %>

but i can't get this done on a user control

Best Answer

Does this work?

<%= Page.User.Identity.IsAuthenticated %>