Authentication Setup in Client object model – Sharepoint 2010

Basically there are three (3) authentication options you can use when you’re working with the Client Object Model in SharePoint 2010:

* Anonymous
* Default
* FormsAuthentication

You can specify clientContext.Authentication = Anonymous\Default\FormsAuthentication
If you do not choose an authentication method in your code, the application will default to using the client’s Windows Credentials (DefaultCredentials). If you are trying to access sharepoint remotely using client application you will have to pass proper credentials.

Lets see some examples :

Windows Network credentials

NetworkCredential credentials = new NetworkCredential(“username”, “pwd”, “domain”);

Anonymous access Authentication

clientcontext.AuthenticationMode = SP.ClientAuthenticationMode.Anonymous;

Form Based Authentication

SP.FormsLoginInfo fbaLogin = new SP.FormsAuthenticationLoginInfo(“isha”, “MyPassword”);

clientcontext.AuthenticationMode = SP.ClientAuthenticationMode.FormsAuthentication;

clientcontext.FormsAuthenticationLoginInfo = fbaLogin;

See the related forum Post form bases authentictaion using client object model

Ads by google