views:

66

answers:

1

The project is a default ASP.net Website built in vs 2010. I am new to asp.net and was just experimenting with the master page to only show a menu when logged in.

I have the following in the master page.

<asp:LoginView ID="MenuLoginView" runat="server" EnableViewState="false">
                    <asp:LoggedinTemplate>
                   <asp:Label runat="server" Text="TESTING"></asp:Label>
                   <asp:Menu ID="NavigationMenu1" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                <Items>
                    <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                    <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>  
                    <asp:MenuItem NavigateUrl="~/Courselist.aspx" Text="About"/>  

                </Items>
            </asp:Menu>
                    </asp:LoggedinTemplate>
                     <AnonymousTemplate>
           <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                <Items>
                    <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                    <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>  

                </Items>
            </asp:Menu>
        </AnonymousTemplate>

                    </asp:LoginView>

The AnonymousTemplate works fine. However when I log into my user the entire menu disappears. I have searched the web and the results were to look at my web config auth tag which looks like this.

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>

What am I doing wrong?

PS. I have also tried to set the MENU IDS to the same name and that is not working either.

Thanks in advance.

+1  A: 

If you implemented a MembershipProvider, be sure that the name of the user is not empty, when you create a MembershipUser:

return new MembershipUser(Name, myUser.Name, ...)

EDIT:

remove the asp namespace from the Loggedintemplate:

<LoggedinTemplate>
....
</LoggedinTemplate>
onof
Sorry but I am not doing any of that in code. I literally only made a new project which comes prebuilt. I was trying to get a new menu to show when only logged in but nothing is showing up. It actually removes the menu when I am logged in. Strangely enough I've added Roles and that responds to the code I have put under the <Roles> .. <Content> but if its under <LoggedinTemplate> nothing happens. I'm at a loss.
Mikael
maybe i have found the problem, look at my answer edit
onof
amazing that was it. Something so small cause all those problems.Thanks
Mikael