c# - ASP.NET Code blocks are not supported in this context Site.master -


im trying write code in master page check if user logged in. here block of code

            <div class="navbar-collapse collapse">                 <asp:loginview runat="server" viewstatemode="disabled">                     <%                       if (session["userid"] == null) {                     %>                     <anonymoustemplate>                         <ul class="nav navbar-nav navbar-right">                             <li><a runat="server" href="~/account/register">register</a></li>                             <li><a runat="server" href="~/account/login">log in</a></li>                         </ul>                     </anonymoustemplate>                     <%                     } else  {                      %>                     <loggedintemplate>                         <ul class="nav navbar-nav navbar-right">                             <li><a runat="server" href="~/account/manage" title="manage account">hello, <%: session["userid"] %>!</a></li>                             <li>                                 <asp:loginstatus runat="server" logoutaction="redirect" logouttext="log off" logoutpageurl="~/" onloggingout="unnamed_loggingout" />                             </li>                         </ul>                     </loggedintemplate>                     <%                     }                     %>                 </asp:loginview>             </div> 

code blocks

<% if (session["userid"] == null) {                 %> ... 

are not allowed inside <asp: runat="server">


Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -