在主文件上得到了...
<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>
还有……
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
和站点地图...
得到代码...
protected void Page_Load()
{
if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
{
}
else
{
} // sorry for formating XD
并且...我需要隐藏或禁用然后启用或显示站点菜单(我的意思是可见内容)
在我正在制作的页面上
protected void Page_Load(object sender, EventArgs e)
{
if (!HttpContext.Current.User.Identity.IsAuthenticated)
Response.Redirect("Default.aspx");
}
我也不确定这是不是一个好方法
最佳答案
如何使用 security trimming ?
关于c# - 临时隐藏或禁用主导航菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2409247/