There Really Is an Authentication Button Class

I got in an argument today over the phone with a co-worker I used to work with that there was no AuthenticationButton Class. Actually, there is a sealed AuthenticationButton class that inherits from System.Web.UI.Control class, the System.Web.UI.INamingContainer interface, and the Microsoft.SharePoint.WebControls. IDesignTimeHtmlProvider.

To be honest, I only used it in SharePoint 2003, but it doesn’t appear to be deprecated in SharePoint 2007, so I am on the ball. So, how do you use it? Well, it is pretty easy, because its like adding any control to a SharePoint WebPart.

The first that you have to do when creating a Windows SharePoint Services custom component that makes use of the AuthenticationButton class to make the appropriate references. The AuthenticationButton class exists in the Microsoft.SharePoint.WebPartPages namespace, so make the reference:

using Microsoft.SharePoint.WebPartPages;

Then, you have to setup your class to use the Authentication Button, so delcare it:

private AuthenticationButton SharePointAuthButton;

In your CreateChildControls() method, create a new AuthenticationButton, and then add it by using the add method out of the controls class.

protected override void CreateChildControls()
SharePointAuthButton = new AuthenticationButton();

Its not real fancy, but I am happy because I was right :-) It only happens far and few between!