Authentication in the Managed Client Object Models
Applies to: SharePoint Foundation 2010
The managed client object models provide a ClientAuthenticationMode enumeration whose values are Anonymous, Default, and FormsAuthentication. To specify Forms authentication, use code similar to the following.
clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication
In addition to setting the authentication mode, you must specify the user name and password information, as shown here.
FormsAuthenticationLoginInfo formsAuthInfo = new FormsAuthenticationLoginInfo("MyUser", "MyPassword"); clientContext.FormsAuthenticationLoginInfo = formsAuthInfo;
Dim formsAuthInfo As New FormsAuthenticationLoginInfo("MyUser", "MyPassword") clientContext.FormsAuthenticationLoginInfo = formsAuthInfo
In the example, if the account name and password contained in formsAuthInfo are sent in clear text, you must use HTTPS protocol instead of HTTP.