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
context
Type: System.UriA context URL that points to an SPWebApplication object.
membershipProviderName
Type: System.StringThe name of a MembershipProvider registered for the SPWebApplication.
roleProviderName
Type: System.StringThe name of a RoleProvider registered for the SPWebApplication.
username
Type: System.StringThe user name to be used with the ValidateUser() method.
password
Type: System.StringThe password to be used with MembershipProvider.ValidateUser.
Return Value
Type: System.IdentityModel.Tokens.SecurityToken
A security token.