tags:

views:

31

answers:

4

on master file got ...

<div id="nav-main">
    <asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
              Width="573px" CssClass="menu-main" MaximumDynamicDisplayLevels="0" 
              StaticSelectedStyle-CssClass="StaticSelectedStyle" Height="32px" 
              StaticSubMenuIndent="18px" >
        <StaticSelectedStyle CssClass="StaticSelectedStyle"></StaticSelectedStyle>
    </asp:Menu>

also got ...

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />

and sitemap...

got code ...

protected void Page_Load()
{
    if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
    {
    }
    else
    {
    } // sorry for formating XD

and ... I need to hide or disable then enable or show site menu (I mean visible content)

On my pages I'm making

protected void Page_Load(object sender, EventArgs e)
{
    if (!HttpContext.Current.User.Identity.IsAuthenticated)
        Response.Redirect("Default.aspx");
}

also I'm not sure if that's a good way

+2  A: 

Wrap it up with a LoginView control?

<asp:LoginView id="LoginView1" runat="server">
    <AnonymousTemplate>
       Please log in for personalized information.
    </AnonymousTemplate>
    <LoggedInTemplate>
       <div id="nav-main">...</div>
    </LoggedInTemplate>
<asp:LoginView>
Naeem Sarfraz
thank you. Very Nice variant.
nCdy
A: 

You can write Menu1.Visible = false;.

SLaks
A: 

If I understood correctly, you want to hide/show menu base on user authenticated or not.

Menu1.Visible = HttpContext.Current.User.Identity.IsAuthenticated;

Saar
. . . I'll try if that will works correct - good :-/
nCdy
+2  A: 

How about using security trimming?

uvita
YES ! you are the best ^_
nCdy