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.

Namespace:  WebSvcAuthentication
Assembly:  STSSOAP (in STSSOAP.dll)

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/Login", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function Login ( _
    username As String, _
    password As String _
) As LoginResult
'Usage
Dim instance As Authentication
Dim username As String
Dim password As String
Dim returnValue As LoginResult

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

Parameters

  • username
    Type: System.String

    The user's logon name for the SharePoint site.

Return value

Type: WebSvcAuthentication.LoginResult
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

WebSvcAuthentication namespace

Membership

FormsAuthentication

Other resources

Authentication, authorization, and security in SharePoint 2013