Hiding some page controls from the Unauthenticated users

If you want to hide controls in the page that is being displayed by the logged in and not logged in users , then you can check the Request.IsAuthenticated property which returns true if the user is logged in ( of course you must be using Windows or Forms authentication). For example, If you want to hide a button from the anonymous users , you can write : Button1.Visible=Request.IsAuthenticated; If you have many controls that you want to hide , you can group them inside a Panel : Panel1.Visible=Request.IsAuthenticated; This will hide the Panel including the controls inside it.

No Comments