This documentation is archived and is not being maintained.

Authentication.Login Method

Windows SharePoint Services 3
Used in a forms-based authentication system to either set an authentication cookie or, if there is a problem with the logon, return an error code.

Web Service: AuthenticationWeb Reference: http://<Site>/_vti_bin/Authentication.asmx

[SoapDocumentMethodAttribute("", RequestNamespace="", ResponseNamespace="", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public LoginResult Login (
	string username,
	string password



The user's logon name for the SharePoint site.


The user's password.

Return Value

A LoginResult structure that contains either an error code in its ErrorCode field or the name of an authentication cookie in its CookieName property.

The Login method uses the authentication services provided by the Membership and FormsAuthentication classes that are provided in Microsoft ASP.NET 2.0.

The cookie contains an authentication ticket that will be used to authenticate subsequent requests to the server.

You may need to impose length or format restrictions on the user name or password, such as requiring passwords to include a numeral or punctuation mark. If so, you must provide your own validation logic before passing the user name and password to the Login method. For performance reasons, this validation step should be performed locally on client computers.