Another little thing that I stumbled across - when trying to hide a control from anonymous users, I just tried the following:

Visible='<%#Page.User.Identity.IsAuthenticated %>'

Now I would have expected that to just work. But when I viewed my page, the controls were still visible. After a bit of trial and error it occurred to me that the <%# syntax is used when databinding. So in my Page_Load method, I just called myControl.DataBind(); and everything worked perfectly.

comments powered by Disqus