I keep getting this error

Parser Error Message: Encountered end tag "nav" with no matching start tag.  Are your start/end tags properly balanced?


Source Error:

Line 110:                         </li>
Line 111:                         </ul>
Line 112:                 </nav>
Line 113:            }    
Line 114:       </div>

My code is fairly simple (using Webmatrix with Razor)

@if (WebSecurity.IsAuthenticated) {     
      <nav>
        <ul>
            
            <li id="login">
                <a id="login-trigger" href="#">
                                        <span id="user-panel-check"></span>
               
                                        <span id="user-panel-title">Welcome, <strong>@WebSecurity.CurrentUserName</strong></span>
                
                    <span id="user-panel"></span>
                </a>
                <div id="login-content">
                  <ul>
                  <li><a href="#"><span>Settings</span> <img src="./images/setting.png" alt=""></a></li>
                  <li><a href="#"><span>Help</span> <img src="./images/help.png" alt=""></a></li>
                  <li><a href="./index.html"><span>Log Out</span> <img src="./images/logout.png" alt=""></a></li>
                  </ul>
               </div>                       
            </li> 
            
        </ul>
      </nav> 
          } else {
                 <nav>
                     <ul>
            
                     <li id="login">
                <a id="login-trigger" href="#">
                                        <span id="user-panel-check"></span>
               
                                        <span id="user-panel-title">Login</strong></span>
                
                    <span id="user-panel"></span>
                </a>   
                         </li>
                         </ul>
                 </nav>
            }

Please advise.

Member Avatar for stbuchok

Why don't you put this outside of the if statement:

<nav>
<ul>
...
</ul>
</nav>

This doesn't say why it's happening, however it will get rid of some redundancy.

On line 32 you have a closing </strong> tag without an opening one. That might have something to do with it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.