How to hide content on certain pages and not others via a Master Page?

后端 未结 2 1659
终归单人心
终归单人心 2021-01-23 09:27

Read this thread but didn\'t really answer my question and there were quite a few suggestions so not sure if they are on the right track: Master Page content filtering with res

2条回答
  •  自闭症患者
    2021-01-23 09:46

    In your MasterPage:

    protected void Page_Load(object sender, EventArgs e)
    {
       var page = HttpContext.Current.Handler as Page;
       FooterControl.Visible = HttpRequest.IsAuthenticated && !(page is LoginPage)
    }
    
    • HttpContext.Handler Property
    • is (C# Reference)

提交回复
热议问题