Share via


SPSecurityContext.SecurityTokenForFormsAuthentication Method

Obtains a security token for a user authenticating through forms-based authentication.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Shared Function SecurityTokenForFormsAuthentication ( _
    context As Uri, _
    membershipProviderName As String, _
    roleProviderName As String, _
    username As String, _
    password As String _
) As SecurityToken
'Usage
Dim context As Uri
Dim membershipProviderName As String
Dim roleProviderName As String
Dim username As String
Dim password As String
Dim returnValue As SecurityToken

returnValue = SPSecurityContext.SecurityTokenForFormsAuthentication(context, _
    membershipProviderName, roleProviderName, _
    username, password)
public static SecurityToken SecurityTokenForFormsAuthentication(
    Uri context,
    string membershipProviderName,
    string roleProviderName,
    string username,
    string password
)

Parameters

  • roleProviderName
    Type: System.String

    The name of a RoleProvider registered for the SPWebApplication.

  • username
    Type: System.String

    The user name to be used with the ValidateUser() method.

  • password
    Type: System.String

    The password to be used with MembershipProvider.ValidateUser.

Return Value

Type: System.IdentityModel.Tokens.SecurityToken
A security token.

See Also

Reference

SPSecurityContext Class

SPSecurityContext Members

Microsoft.SharePoint Namespace