Authentication.Login Method

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

Syntax

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/Login", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function Login ( _
    username As String, _
    password As String _
) As LoginResult

Dim instance As Authentication
Dim username As String
Dim password As String
Dim returnValue As LoginResult

returnValue = instance.Login(username, password)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/Login", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public LoginResult Login (
    string username,
    string password
)

Parameters

  • username
    The user's logon name for the SharePoint site.
  • password
    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.

Remarks

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.

See Also

Reference

Authentication Class
Authentication Members
Authentication Web Service
Membership
FormsAuthentication

Other Resources

Authorization and Authentication