代码改变世界

解析petshop3.0的顶部信息

2006-04-22 14:03  Clingingboy  阅读(526)  评论(0编辑  收藏  举报
       petshop定义了三个顶部信息的用户控件,一个是首页的NavBarNoMenu.ascx,这个用户控件没有产品导航条

一个是具有导航条的NavBar.ascx,两个页面存在一个相同的函数,判断用户是否登录,然后做出不同的显示




     

 1// properties
 2        public bool hidecategorymenu = false;
 3
 4        private void Page_Load(object sender, System.EventArgs e)
 5        {
 6            // Put user code to initialize the page here
 7            //ShowMenuArea();
 8            ShowLoggedInArea();
 9        }

10
11        // display different items if person is logged in or not
12        private void ShowLoggedInArea() {
13
14            if (Request.IsAuthenticated != true{
15                
16                areaLoggedIn.Visible = false;
17                areaLoggedOut.Visible = true;
18
19            }
 else {
20                
21                areaLoggedIn.Visible = true;
22                areaLoggedOut.Visible = false;
23
24            }

25        }


最后还有一个静态的SignOutNavBar.ascx用户控件.当用户登出的时候显示这个用户控件